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
GCGeneration
instances of that segment and of the segment containing the repository head: Lets
be a segment,h
be the segment containing the current repository head andn
be the number of retained generations.s
is old iffh.generation - s.generation >= n
s
is in the same compaction tail than h iffs.isCompacted && s.fullGeneration == h.fullGeneration
s
is reclaimable iffs
is old ands
is not in the same compaction tail thanh
-
-
Field Summary
Fields Modifier and Type Field Description static GCGeneration
NULL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareFullGenerationWith(@NotNull GCGeneration gcGeneration)
Compare this full generation the full generation ofgcGeneration
int
compareWith(@NotNull GCGeneration gcGeneration)
Compare this generation withgcGeneration
boolean
equals(Object other)
int
getFullGeneration()
int
getGeneration()
int
hashCode()
boolean
isCompacted()
static GCGeneration
newGCGeneration(int generation, int fullGeneration, boolean isCompacted)
static GCGeneration
newGCGeneration(SegmentArchiveEntry indexEntry)
@NotNull GCGeneration
nextFull()
Create a new instance with the generation and the full generation incremented by one and the compaction flag left unchanged.@NotNull GCGeneration
nextTail()
Create a new instance with the generation incremented by one and the full generation and the compaction flag left unchanged.@NotNull GCGeneration
nonGC()
Create a new instance with the compaction flag unset and the generation and the full generation left unchanged.String
toString()
-
-
-
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 left unchanged.
-
nextTail
@NotNull public @NotNull GCGeneration nextTail()
Create a new instance with the generation incremented by one and the full generation and the compaction flag 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
-
-