public class HollowCompactor
extends java.lang.Object
The HollowCompactor can reclaim space by moving records off of the high end of the ordinal space into these holes.
This is accomplished by producing deltas which only include removals and additions of identical records allocated to more optimal ordinals.
This must sometimes be accomplished with a series of deltas, because the remapping of one state will cause some removals/additions in referencing states (since they will point to new ordinals). In a single delta transition, the HollowCompactor will only attempt to compact a set of types which are not referencing each other (either directly or transitively).
Modifier and Type | Class and Description |
---|---|
static class |
HollowCompactor.CompactionConfig
A configuration that specifies when a type is a candidate for compaction.
|
Constructor and Description |
---|
HollowCompactor(HollowWriteStateEngine writeEngine,
HollowReadStateEngine readEngine,
HollowCompactor.CompactionConfig config)
Provide the state engines on which to operate, and the criteria to identify when a compaction is necessary
|
HollowCompactor(HollowWriteStateEngine writeEngine,
HollowReadStateEngine readEngine,
long minCandidateHoleCostInBytes,
int minCandidateHolePercentage)
Provide the state engines on which to operate, and the criteria to identify when a compaction is necessary
|
Modifier and Type | Method and Description |
---|---|
void |
compact()
Perform a compaction.
|
boolean |
needsCompaction()
Determine whether a compaction is necessary, based on the criteria specified in the constructor.
|
public HollowCompactor(HollowWriteStateEngine writeEngine, HollowReadStateEngine readEngine, HollowCompactor.CompactionConfig config)
writeEngine
- the HollowWriteStateEngine to compactreadEngine
- a HollowReadStateEngine at the same data state as the writeEngineconfig
- The criteria to identify when a compaction is necessary.public HollowCompactor(HollowWriteStateEngine writeEngine, HollowReadStateEngine readEngine, long minCandidateHoleCostInBytes, int minCandidateHolePercentage)
writeEngine
- the HollowWriteStateEngine to compactreadEngine
- a HollowReadStateEngine at the same data state as the writeEngineminCandidateHoleCostInBytes
- identify a type as a candidate for compaction only when the bytes used by ordinal holes exceeds this valueminCandidateHolePercentage
- identify a type as a candidate for compaction only when the percentage of space used by ordinal holes exceeds this valuepublic boolean needsCompaction()
public void compact()
HollowWriteStateEngine
supplied in the constructor is unmodified since the
last call to HollowWriteStateEngine.prepareForNextCycle()
HollowReadStateEngine
supplied in the constructor reflects the same state as
the HollowWriteStateEngine.