public final class MinorCompactionTask extends Object implements CompactionTask
released entries from an individual
log Segment to reclaim disk space.
The minor compaction task is a lightweight process that rewrites an individual segment to remove entries for that do not have to be removed sequentially from the log.
When a segment is rewritten by the minor compaction task, a new compact segment is created with the same starting
index as the segment being compacted and the next greatest version number. The version number allows the
SegmentManager to account for failures during log compaction when recovering the log from disk. If a failure
occurs during minor compaction, the segment manager will attempt to load the segment with the greatest version
for a given range of entries from disk. If the segment with the greatest version did not finish compaction, it
will be discarded and the old segment will be used. Once the minor compaction task is done rewriting a segment,
it will SegmentDescriptor.lock() the segment to indicate that the segment has completed compaction and
is safe to read, and the compacted segment will be made available to the Log.
Copyright © 2013–2016. All rights reserved.