Class SegmentGCOptions
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions
-
public class SegmentGCOptions extends Object
This class holds configuration options for segment store revision gc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSegmentGCOptions.CompactorTypeThe compactor typestatic classSegmentGCOptions.GCTypeThe gc type.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CONCURRENCYDefault value forgetConcurrency()static booleanDISABLE_ESTIMATION_DEFAULTDefault value forisEstimationDisabled()static intFORCE_TIMEOUT_DEFAULTDefault value forgetForceTimeout()in seconds.static longGC_PROGRESS_LOG_DEFAULTDefault value for the gc progress logstatic intMEMORY_THRESHOLD_DEFAULTDefault value forgetMemoryThreshold()static booleanPAUSE_DEFAULTDefault value forisPaused()static intRETAINED_GENERATIONS_DEFAULTDefault value forgetRetainedGenerations()static intRETRY_COUNT_DEFAULTDefault value forgetRetryCount()static longSIZE_DELTA_ESTIMATION_DEFAULTDefault value forgetGcSizeDeltaEstimation().
-
Constructor Summary
Constructors Constructor Description SegmentGCOptions()SegmentGCOptions(boolean paused, int retryCount, int forceTimeout)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SegmentGCOptionsdefaultGCOptions()SegmentGCOptions.CompactorTypegetCompactorType()intgetConcurrency()intgetForceTimeout()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.longgetGcLogInterval()longgetGcSizeDeltaEstimation()@NotNull SegmentGCOptions.GCTypegetGCType()intgetMemoryThreshold()Get the available memory threshold beyond which revision gc will be canceled.intgetRetainedGenerations()Number of segment generations to retain.intgetRetryCount()Get the number of tries to compact concurrent commits on top of already compacted commitsstatic booleanisDiskSpaceSufficient(long repositoryDiskSpace, long availableDiskSpace)Check if the approximate repository size is getting too big compared with the available space on disk.booleanisEstimationDisabled()booleanisOffline()booleanisPaused()SegmentGCOptionssetCompactorType(SegmentGCOptions.CompactorType compactorType)Sets the compactor type to be used for compactionSegmentGCOptionssetConcurrency(int concurrency)Sets the concurrency level for compactionSegmentGCOptionssetEstimationDisabled(boolean disabled)Disables the estimation phase, thus allowing GC to run every time.SegmentGCOptionssetForceTimeout(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.SegmentGCOptionssetGCLogInterval(long gcLogInterval)Set the number of nodes after which an update about the compaction process is logged.SegmentGCOptionssetGcSizeDeltaEstimation(long gcSizeDeltaEstimation)voidsetGCType(@NotNull SegmentGCOptions.GCType gcType)Set the gc type.SegmentGCOptionssetMemoryThreshold(int memoryThreshold)Set the available memory threshold beyond which revision gc will be canceled.SegmentGCOptionssetOffline()Enables the offline compaction mode, allowing for certain optimizations, like reducing the retained generation to 1.SegmentGCOptionssetPaused(boolean paused)Set revision gc to paused.SegmentGCOptionssetRetainedGenerations(int retainedGenerations)Set the number of segment generations to retain: each compaction run creates a new segment generation.SegmentGCOptionssetRetryCount(int retryCount)Set the number of tries to compact concurrent commits on top of already compacted commitsStringtoString()
-
-
-
Field Detail
-
PAUSE_DEFAULT
public static final boolean PAUSE_DEFAULT
Default value forisPaused()- See Also:
- Constant Field Values
-
DISABLE_ESTIMATION_DEFAULT
public static final boolean DISABLE_ESTIMATION_DEFAULT
Default value forisEstimationDisabled()- See Also:
- Constant Field Values
-
RETRY_COUNT_DEFAULT
public static final int RETRY_COUNT_DEFAULT
Default value forgetRetryCount()- See Also:
- Constant Field Values
-
FORCE_TIMEOUT_DEFAULT
public static final int FORCE_TIMEOUT_DEFAULT
Default value forgetForceTimeout()in seconds.- See Also:
- Constant Field Values
-
RETAINED_GENERATIONS_DEFAULT
public static final int RETAINED_GENERATIONS_DEFAULT
Default value forgetRetainedGenerations()- See Also:
- Constant Field Values
-
SIZE_DELTA_ESTIMATION_DEFAULT
public static final long SIZE_DELTA_ESTIMATION_DEFAULT
Default value forgetGcSizeDeltaEstimation().- See Also:
- Constant Field Values
-
GC_PROGRESS_LOG_DEFAULT
public static final long GC_PROGRESS_LOG_DEFAULT
Default value for the gc progress log- See Also:
- Constant Field Values
-
MEMORY_THRESHOLD_DEFAULT
public static final int MEMORY_THRESHOLD_DEFAULT
Default value forgetMemoryThreshold()- See Also:
- Constant Field Values
-
DEFAULT_CONCURRENCY
public static final int DEFAULT_CONCURRENCY
Default value forgetConcurrency()- See Also:
- Constant Field Values
-
-
Method Detail
-
defaultGCOptions
public static SegmentGCOptions defaultGCOptions()
-
isPaused
public boolean isPaused()
- Returns:
trueiff 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.retainGenerationsdetermines how many of those generations are retained during cleanup.- Parameters:
retainedGenerations- number of generations to retain. Must be>= 2.- Returns:
- this instance
- Throws:
IllegalArgumentException- ifretainGenerations < 2
-
getGCType
@NotNull public @NotNull SegmentGCOptions.GCType getGCType()
- Returns:
- the currently set gc type.
-
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:
trueif 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 between0and100will 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 between0and100is expected. Setting this to0will 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.
-
getCompactorType
public SegmentGCOptions.CompactorType getCompactorType()
- Returns:
- the current compactor type (i.e. classic, checkpoint-aware or parallel)
-
setCompactorType
public SegmentGCOptions setCompactorType(SegmentGCOptions.CompactorType compactorType)
Sets the compactor type to be used for compaction- Parameters:
compactorType-- Returns:
- this instance
-
getConcurrency
public int getConcurrency()
- Returns:
- the current level of concurrency
-
setConcurrency
public SegmentGCOptions setConcurrency(int concurrency)
Sets the concurrency level for compaction- Parameters:
concurrency- number of threads to use- Returns:
- this instance
-
-