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 class
SegmentGCOptions.CompactorType
The compactor typestatic class
SegmentGCOptions.GCType
The gc type.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CONCURRENCY
Default value forgetConcurrency()
static boolean
DISABLE_ESTIMATION_DEFAULT
Default value forisEstimationDisabled()
static int
FORCE_TIMEOUT_DEFAULT
Default value forgetForceTimeout()
in seconds.static long
GC_PROGRESS_LOG_DEFAULT
Default value for the gc progress logstatic int
MEMORY_THRESHOLD_DEFAULT
Default value forgetMemoryThreshold()
static boolean
PAUSE_DEFAULT
Default value forisPaused()
static int
RETAINED_GENERATIONS_DEFAULT
Default value forgetRetainedGenerations()
static int
RETRY_COUNT_DEFAULT
Default value forgetRetryCount()
static long
SIZE_DELTA_ESTIMATION_DEFAULT
Default 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 SegmentGCOptions
defaultGCOptions()
SegmentGCOptions.CompactorType
getCompactorType()
int
getConcurrency()
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.long
getGcLogInterval()
long
getGcSizeDeltaEstimation()
@NotNull SegmentGCOptions.GCType
getGCType()
int
getMemoryThreshold()
Get the available memory threshold beyond which revision gc will be canceled.int
getRetainedGenerations()
Number of segment generations to retain.int
getRetryCount()
Get the number of tries to compact concurrent commits on top of already compacted commitsstatic boolean
isDiskSpaceSufficient(long repositoryDiskSpace, long availableDiskSpace)
Check if the approximate repository size is getting too big compared with the available space on disk.boolean
isEstimationDisabled()
boolean
isOffline()
boolean
isPaused()
SegmentGCOptions
setCompactorType(SegmentGCOptions.CompactorType compactorType)
Sets the compactor type to be used for compactionSegmentGCOptions
setConcurrency(int concurrency)
Sets the concurrency level for compactionSegmentGCOptions
setEstimationDisabled(boolean disabled)
Disables the estimation phase, thus allowing GC to run every time.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.SegmentGCOptions
setGCLogInterval(long gcLogInterval)
Set the number of nodes after which an update about the compaction process is logged.SegmentGCOptions
setGcSizeDeltaEstimation(long gcSizeDeltaEstimation)
void
setGCType(@NotNull SegmentGCOptions.GCType gcType)
Set the gc type.SegmentGCOptions
setMemoryThreshold(int memoryThreshold)
Set the available memory threshold beyond which revision gc will be canceled.SegmentGCOptions
setOffline()
Enables the offline compaction mode, allowing for certain optimizations, like reducing the retained generation to 1.SegmentGCOptions
setPaused(boolean paused)
Set revision gc to paused.SegmentGCOptions
setRetainedGenerations(int retainedGenerations)
Set the number of segment generations to retain: each compaction run creates a new segment generation.SegmentGCOptions
setRetryCount(int retryCount)
Set the number of tries to compact concurrent commits on top of already compacted commitsString
toString()
-
-
-
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:
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
- 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:
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 between0
and100
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 between0
and100
is expected. Setting this to0
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.
-
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
-
-