Class GCGeneration
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.file.tar.GCGeneration
-
public final class GCGeneration extends Object
Instances of this class represent the garbage collection generation related information of a segment. It consists of the segment's generation, its full generation and its compaction flag. The segment's generation records the number of garbage collection cycles a segment went through and is incremented with every garbage collection regardless its type. The segment's full generation records the number of full garbage collection cycles a segment went through. It is only incremented on full garbage collection cycles. The segment's compaction flag is set for those segments that have been created by a compaction operation. It is never set for segments created by normal write operations or defer compactions triggered by such. Segments written by normal repository writes will inherit the generation and full generation of the segment written by the previous compaction process with the compacted flag cleared.The information recorded in this way allows to determine the reclamation status of a segment by just looking at the
GCGenerationinstances of that segment and of the segment containing the repository head: Letsbe a segment,hbe the segment containing the current repository head andnbe the number of retained generations.sis old iffh.generation - s.generation >= nsis in the same compaction tail than h iffs.isCompacted && s.fullGeneration == h.fullGenerationsis reclaimable iffsis old andsis not in the same compaction tail thanh
-
-
Field Summary
Fields Modifier and Type Field Description static GCGenerationNULL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareFullGenerationWith(@NotNull GCGeneration gcGeneration)Compare this full generation the full generation ofgcGenerationintcompareWith(@NotNull GCGeneration gcGeneration)Compare this generation withgcGenerationbooleanequals(Object other)intgetFullGeneration()intgetGeneration()inthashCode()booleanisCompacted()static GCGenerationnewGCGeneration(int generation, int fullGeneration, boolean isCompacted)static GCGenerationnewGCGeneration(SegmentArchiveEntry indexEntry)@NotNull GCGenerationnextFull()Create a new instance with the generation and the full generation incremented by one and the compaction flag set.@NotNull GCGenerationnextPartial()Create a new instance with the compaction flag set and the generation and the full generation left unchanged.@NotNull GCGenerationnextTail()Create a new instance with the generation incremented by one, the full generation left unchanged and the compaction flag set.@NotNull GCGenerationnonGC()Create a new instance with the compaction flag unset and the generation and the full generation left unchanged.StringtoString()
-
-
-
Field Detail
-
NULL
public static final GCGeneration NULL
-
-
Method Detail
-
newGCGeneration
public static GCGeneration newGCGeneration(int generation, int fullGeneration, boolean isCompacted)
-
newGCGeneration
public static GCGeneration newGCGeneration(SegmentArchiveEntry indexEntry)
-
getGeneration
public int getGeneration()
-
getFullGeneration
public int getFullGeneration()
-
isCompacted
public boolean isCompacted()
-
nextFull
@NotNull public @NotNull GCGeneration nextFull()
Create a new instance with the generation and the full generation incremented by one and the compaction flag set.
-
nextTail
@NotNull public @NotNull GCGeneration nextTail()
Create a new instance with the generation incremented by one, the full generation left unchanged and the compaction flag set.
-
nextPartial
@NotNull public @NotNull GCGeneration nextPartial()
Create a new instance with the compaction flag set and the generation and the full generation left unchanged.
-
nonGC
@NotNull public @NotNull GCGeneration nonGC()
Create a new instance with the compaction flag unset and the generation and the full generation left unchanged.
-
compareWith
public int compareWith(@NotNull @NotNull GCGeneration gcGeneration)Compare this generation withgcGeneration- Parameters:
gcGeneration- the generation this generation is compared against.- Returns:
- Number of generations between this generation and
gcGeneration
-
compareFullGenerationWith
public int compareFullGenerationWith(@NotNull @NotNull GCGeneration gcGeneration)Compare this full generation the full generation ofgcGeneration- Parameters:
gcGeneration- the generation this generation is compared against.- Returns:
- Number of generations between the full generations of this generation
and
gcGeneration
-
-