public final class CombinedDeletionPolicy
extends org.apache.lucene.index.IndexDeletionPolicy
IndexDeletionPolicy
that coordinates between Lucene's commits and the retention of translog generation files,
making sure that all translog files that are needed to recover from the Lucene commit are not deleted.
In particular, this policy will delete index commits whose max sequence number is at most the current global checkpoint except the index commit which has the highest max sequence number among those.
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
commitDescription(org.apache.lucene.index.IndexCommit commit) |
Returns a description for a given
IndexCommit . |
static org.apache.lucene.index.IndexCommit |
findSafeCommitPoint(java.util.List<org.apache.lucene.index.IndexCommit> commits,
long globalCheckpoint) |
Find a safe commit point from a list of existing commits based on the supplied global checkpoint.
|
void |
onCommit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits) |
|
void |
onInit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits) |
public void onInit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits) throws java.io.IOException
onInit
in class org.apache.lucene.index.IndexDeletionPolicy
java.io.IOException
public void onCommit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits) throws java.io.IOException
onCommit
in class org.apache.lucene.index.IndexDeletionPolicy
java.io.IOException
public static org.apache.lucene.index.IndexCommit findSafeCommitPoint(java.util.List<org.apache.lucene.index.IndexCommit> commits, long globalCheckpoint) throws java.io.IOException
commits
- a list of existing commit pointsglobalCheckpoint
- the persisted global checkpoint from the translog, see Translog.readGlobalCheckpoint(Path, String)
java.io.IOException
public static java.lang.String commitDescription(org.apache.lucene.index.IndexCommit commit) throws java.io.IOException
IndexCommit
. This should be only used for logging and debugging.java.io.IOException