Class SegmentGCOptions


  • public class SegmentGCOptions
    extends Object
    This class holds configuration options for segment store revision gc.
    • Constructor Detail

      • SegmentGCOptions

        public SegmentGCOptions​(boolean paused,
                                int retryCount,
                                int forceTimeout)
      • SegmentGCOptions

        public SegmentGCOptions()
    • Method Detail

      • isPaused

        public boolean isPaused()
        Returns:
        true iff revision gc is paused.
      • setPaused

        public SegmentGCOptions setPaused​(boolean paused)
        Set revision gc to paused.
        Parameters:
        paused -
        Returns:
        this instance
      • getRetryCount

        public int getRetryCount()
        Get the number of tries to compact concurrent commits on top of already compacted commits
        Returns:
        retry count
      • setRetryCount

        public SegmentGCOptions setRetryCount​(int retryCount)
        Set the number of tries to compact concurrent commits on top of already compacted commits
        Parameters:
        retryCount -
        Returns:
        this instance
      • getForceTimeout

        public int getForceTimeout()
        Get the number of seconds to attempt to force compact concurrent commits on top of already compacted commits after the maximum number of retries has been reached. Forced compaction acquires an exclusive write lock on the node store.
        Returns:
        the number of seconds until forced compaction gives up and the exclusive write lock on the node store is released.
      • setForceTimeout

        public SegmentGCOptions setForceTimeout​(int timeout)
        Set the number of seconds to attempt to force compact concurrent commits on top of already compacted commits after the maximum number of retries has been reached. Forced compaction acquires an exclusively write lock on the node store.
        Parameters:
        timeout - the number of seconds until forced compaction gives up and the exclusive lock on the node store is released.
        Returns:
        this instance
      • getRetainedGenerations

        public int getRetainedGenerations()
        Number of segment generations to retain.
        Returns:
        number of gc generations.
      • setRetainedGenerations

        public SegmentGCOptions setRetainedGenerations​(int retainedGenerations)
        Set the number of segment generations to retain: each compaction run creates a new segment generation. retainGenerations determines how many of those generations are retained during cleanup.
        Parameters:
        retainedGenerations - number of generations to retain. Must be >= 2.
        Returns:
        this instance
        Throws:
        IllegalArgumentException - if retainGenerations < 2
      • setGCType

        public void setGCType​(@NotNull
                              @NotNull SegmentGCOptions.GCType gcType)
        Set the gc type.
        Parameters:
        gcType - the type of gc to run.
      • isDiskSpaceSufficient

        public static boolean isDiskSpaceSufficient​(long repositoryDiskSpace,
                                                    long availableDiskSpace)
        Check if the approximate repository size is getting too big compared with the available space on disk.
        Parameters:
        repositoryDiskSpace - Approximate size of the disk space occupied by the repository.
        availableDiskSpace - Currently available disk space.
        Returns:
        true if the available disk space is considered enough for normal repository operations.
      • isOffline

        public boolean isOffline()
      • setOffline

        public SegmentGCOptions setOffline()
        Enables the offline compaction mode, allowing for certain optimizations, like reducing the retained generation to 1.
        Returns:
        this instance
      • getGcSizeDeltaEstimation

        public long getGcSizeDeltaEstimation()
      • setGcSizeDeltaEstimation

        public SegmentGCOptions setGcSizeDeltaEstimation​(long gcSizeDeltaEstimation)
      • getMemoryThreshold

        public int getMemoryThreshold()
        Get the available memory threshold beyond which revision gc will be canceled. Value represents a percentage so an value between 0 and 100 will be returned.
        Returns:
        memoryThreshold
      • setMemoryThreshold

        public SegmentGCOptions setMemoryThreshold​(int memoryThreshold)
        Set the available memory threshold beyond which revision gc will be canceled. Value represents a percentage so an input between 0 and 100 is expected. Setting this to 0 will disable the check.
        Parameters:
        memoryThreshold -
        Returns:
        this instance
      • isEstimationDisabled

        public boolean isEstimationDisabled()
      • setEstimationDisabled

        public SegmentGCOptions setEstimationDisabled​(boolean disabled)
        Disables the estimation phase, thus allowing GC to run every time.
        Returns:
        this instance
      • setGCLogInterval

        public SegmentGCOptions setGCLogInterval​(long gcLogInterval)
        Set the number of nodes after which an update about the compaction process is logged. -1 for never.
        Parameters:
        gcLogInterval - update interval
        Returns:
        this instance
      • getGcLogInterval

        public long getGcLogInterval()
        Returns:
        Number of nodes after which an update about the compaction process is logged. -1 for never.