Class CheckpointCompactor
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.Compactor
-
- org.apache.jackrabbit.oak.segment.CheckpointCompactor
-
- Direct Known Subclasses:
ParallelCompactor
public class CheckpointCompactor extends Compactor
This compactor implementation is aware of the checkpoints in the repository. It uses this information to further optimise the compaction result by- Rebasing the checkpoints and subsequently the root on top of each other in chronological order. This results minimises the deltas that need to be processed and stored.
- Caching the compacted checkpoints and root states for deduplication should the same checkpoint or root state occur again in a later compaction retry cycle.
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull ClassicCompactor
compactor
protected @NotNull GCMonitor
gcListener
-
Constructor Summary
Constructors Constructor Description CheckpointCompactor(@NotNull GCMonitor gcListener, @NotNull CompactionWriter writer, @NotNull GCNodeWriteMonitor compactionMonitor)
Create a new instance based on the passed arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable CompactedNodeState
compact(@NotNull NodeState before, @NotNull NodeState after, @NotNull NodeState onto, @NotNull Canceller canceller)
compact the differences betweenafter
andbefore
on top ofonto
.@Nullable CompactedNodeState
compactDown(@NotNull NodeState before, @NotNull NodeState after, @NotNull Canceller hardCanceller, @NotNull Canceller softCanceller)
compact the differences betweenafter
andbefore
on top ofafter
.protected @Nullable CompactedNodeState
compactDownWithDelegate(@NotNull NodeState before, @NotNull NodeState after, @NotNull Canceller hardCanceller, @NotNull Canceller softCanceller)
Delegate compaction to another, usually simpler, implementation.protected @Nullable CompactedNodeState
compactWithDelegate(@NotNull NodeState before, @NotNull NodeState after, @NotNull NodeState onto, @NotNull Canceller canceller)
-
Methods inherited from class org.apache.jackrabbit.oak.segment.Compactor
compactDown, compactUp, compactUp
-
-
-
-
Field Detail
-
gcListener
@NotNull protected final @NotNull GCMonitor gcListener
-
compactor
@NotNull protected final @NotNull ClassicCompactor compactor
-
-
Constructor Detail
-
CheckpointCompactor
public CheckpointCompactor(@NotNull @NotNull GCMonitor gcListener, @NotNull @NotNull CompactionWriter writer, @NotNull @NotNull GCNodeWriteMonitor compactionMonitor)
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 binaries
-
-
Method Detail
-
compactDown
@Nullable public @Nullable CompactedNodeState compactDown(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull Canceller hardCanceller, @NotNull @NotNull Canceller softCanceller) throws IOException
Description copied from class:Compactor
compact the differences betweenafter
andbefore
on top ofafter
.- Specified by:
compactDown
in classCompactor
- Parameters:
before
- the node state to diff against fromafter
after
- the node state diffed againstbefore
hardCanceller
- the trigger for hard cancellation, will abandon compaction if cancelledsoftCanceller
- the trigger for soft cancellation, will return partially compacted state if cancelled- Returns:
- the compacted node state or
null
if hard-cancelled - Throws:
IOException
- will throw exception if any errors occur during compaction
-
compact
@Nullable public @Nullable CompactedNodeState compact(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull NodeState onto, @NotNull @NotNull Canceller canceller) throws IOException
Description copied from class:Compactor
compact the differences betweenafter
andbefore
on top ofonto
.- Specified by:
compact
in classCompactor
- Parameters:
before
- the node state to diff against fromafter
after
- the node state diffed againstbefore
onto
- the node state to compact to apply the diff tocanceller
- the trigger for hard cancellation, will abandon compaction if cancelled- Returns:
- the compacted node state or
null
if hard-cancelled - Throws:
IOException
- will throw exception if any errors occur during compaction
-
compactDownWithDelegate
@Nullable protected @Nullable CompactedNodeState compactDownWithDelegate(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull Canceller hardCanceller, @NotNull @NotNull Canceller softCanceller) throws IOException
Delegate compaction to another, usually simpler, implementation.- Throws:
IOException
-
compactWithDelegate
@Nullable protected @Nullable CompactedNodeState compactWithDelegate(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull NodeState onto, @NotNull @NotNull Canceller canceller) throws IOException
- Throws:
IOException
-
-