public final class MajorCompactionManager extends Object implements CompactionManager
Compaction.MAJOR compaction process.
Major compaction works by iterating through all committed Segments in the log and rewriting and
combining segments to compact them together. Because of the sequential nature of major compaction, the major
compaction manager builds only a single MajorCompactionTask which will rewrite the log sequentially.
Segments are provided to the major compaction task in groups that indicate which segments to combine. A set
of segments can be combined if they meet the following criteria:
Storage.maxSegmentSize()Storage.maxEntriesPerSegment()| Modifier and Type | Method and Description |
|---|---|
List<CompactionTask> |
buildTasks(Storage storage,
SegmentManager segments)
Builds compaction tasks for the given segments.
|
List<List<Segment>> |
getCompactableGroups(Storage storage,
SegmentManager manager)
Returns a list of segments lists to compact, where segments are grouped according to how they will be merged during
compaction.
|
public List<CompactionTask> buildTasks(Storage storage, SegmentManager segments)
CompactionManager
The collection of compaction tasks will be run in parallel in a pool of
Storage.compactionThreads() background threads. Implementations should ensure that
individual tasks can be run in parallel by operating on different segments in the log.
buildTasks in interface CompactionManagerstorage - The storage configuration.segments - The segments for which to build compaction tasks.public List<List<Segment>> getCompactableGroups(Storage storage, SegmentManager manager)
Copyright © 2013–2016. All rights reserved.