Class ParallelCompactor
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.Compactor
-
- org.apache.jackrabbit.oak.segment.ClassicCompactor
-
- org.apache.jackrabbit.oak.segment.ParallelCompactor
-
public class ParallelCompactor extends ClassicCompactor
This compactor implementation leverages the tree structure of the repository for concurrent compaction. It explores the tree breadth-first until the target node count (10000) is reached. Every node at this depth will be an entry point for asynchronous compaction. After the exploration phase, the main thread will collect these compaction results and write their parents' node state to disk.
-
-
Constructor Summary
Constructors Constructor Description ParallelCompactor(@NotNull GCMonitor gcListener, @NotNull CompactionWriter writer, @NotNull GCNodeWriteMonitor compactionMonitor, int nThreads)Create a new instance based on the passed arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected @Nullable CompactedNodeStatecompact(@NotNull NodeState before, @NotNull NodeState after, @NotNull NodeState onto, @NotNull Canceller hardCanceller, @Nullable Canceller softCanceller)Compact the differences betweenafterandbeforeon top ofonto.-
Methods inherited from class org.apache.jackrabbit.oak.segment.ClassicCompactor
compact, compact, compactDown, getPreviouslyCompactedState, writeNodeState
-
Methods inherited from class org.apache.jackrabbit.oak.segment.Compactor
compactDown, compactUp, compactUp
-
-
-
-
Constructor Detail
-
ParallelCompactor
public ParallelCompactor(@NotNull @NotNull GCMonitor gcListener, @NotNull @NotNull CompactionWriter writer, @NotNull @NotNull GCNodeWriteMonitor compactionMonitor, int nThreads)Create a new instance based on the passed arguments.- Parameters:
gcListener- listener receiving notifications about the garbage collection processwriter- segment writer used to serialise to segmentscompactionMonitor- notification call back for each compacted nodes, properties, and binariesnThreads- number of threads to use for parallel compaction, negative numbers are interpreted relative to the number of available processors
-
-
Method Detail
-
compact
@Nullable protected @Nullable CompactedNodeState compact(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull NodeState onto, @NotNull @NotNull Canceller hardCanceller, @Nullable @Nullable Canceller softCanceller) throws IOException
Description copied from class:ClassicCompactorCompact the differences betweenafterandbeforeon top ofonto. ThesoftCancellermust be null, unlessafter.equals(onto), i.e. if the method is called for aClassicCompactor.compactDown(NodeState, NodeState, Canceller, Canceller)scenario. .- Overrides:
compactin classClassicCompactor- Parameters:
before- The node state used as the baseline for the diff.after- The node state used as the target for the diff.onto- The node state to apply the diff to.hardCanceller- The trigger for hard cancellation, will abandon compaction if cancelled.softCanceller- The trigger for soft cancellation, will return partially compacted state if cancelled. Must be null unlessafter.equals(onto).- Returns:
- The compacted node state or
nullif hard-cancelled. - Throws:
IOException- Will throw exception if any errors occur during compaction.
-
-