Package io.atomix.raft.impl
Class LogCompactor
java.lang.Object
io.atomix.raft.impl.LogCompactor
-
Constructor Summary
ConstructorsConstructorDescriptionLogCompactor(ThreadContext threadContext, RaftLog log, int replicationThreshold, RaftServiceMetrics metrics, org.slf4j.Logger logger) -
Method Summary
Modifier and TypeMethodDescriptionbooleancompact()Assumes our snapshots are being taken asynchronously, and we regularly update the compactable index.booleanAssumes our snapshots are being taken asynchronously, and we regularly update the compactable index.voidsetCompactableIndex(long index)
-
Constructor Details
-
LogCompactor
public LogCompactor(ThreadContext threadContext, RaftLog log, int replicationThreshold, RaftServiceMetrics metrics, org.slf4j.Logger logger)
-
-
Method Details
-
compact
public boolean compact()Assumes our snapshots are being taken asynchronously, and we regularly update the compactable index. It can happen that nothing is compacted (e.g. there are no snapshots since the last compaction).The log is compacted up to the latest compactable index, minus the configured replication threshold. This is done in order to avoid replicating snapshots too much, which is often times more expensive than replicating some entries.
- Returns:
- true if any data was deleted, false otherwise
-
compactIgnoringReplicationThreshold
public boolean compactIgnoringReplicationThreshold()Assumes our snapshots are being taken asynchronously, and we regularly update the compactable index. It can happen that nothing is compacted (e.g. there are no snapshots since the last compaction).The log is compacted up to the latest compactable index, ignoring the replication threshold.
- Returns:
- true if any data was deleted, false otherwise
-
setCompactableIndex
public void setCompactableIndex(long index)
-