Package org.elasticsearch.index.engine
Class CombinedDeletionPolicy
- java.lang.Object
-
- org.apache.lucene.index.IndexDeletionPolicy
-
- org.elasticsearch.index.engine.CombinedDeletionPolicy
-
public final class CombinedDeletionPolicy extends org.apache.lucene.index.IndexDeletionPolicyAnIndexDeletionPolicythat 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.
-
-
Method Summary
Modifier and Type Method Description static java.lang.StringcommitDescription(org.apache.lucene.index.IndexCommit commit)Returns a description for a givenIndexCommit.static org.apache.lucene.index.IndexCommitfindSafeCommitPoint(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.voidonCommit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits)voidonInit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits)
-
-
-
Method Detail
-
onInit
public void onInit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits) throws java.io.IOException- Specified by:
onInitin classorg.apache.lucene.index.IndexDeletionPolicy- Throws:
java.io.IOException
-
onCommit
public void onCommit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits) throws java.io.IOException- Specified by:
onCommitin classorg.apache.lucene.index.IndexDeletionPolicy- Throws:
java.io.IOException
-
findSafeCommitPoint
public static org.apache.lucene.index.IndexCommit findSafeCommitPoint(java.util.List<org.apache.lucene.index.IndexCommit> commits, long globalCheckpoint) throws java.io.IOExceptionFind a safe commit point from a list of existing commits based on the supplied global checkpoint. The max sequence number of a safe commit point should be at most the global checkpoint. If an index was created before v6.2, and we haven't retained a safe commit yet, this method will return the oldest commit.- Parameters:
commits- a list of existing commit pointsglobalCheckpoint- the persisted global checkpoint from the translog, seeTranslog.readGlobalCheckpoint(Path, String)- Returns:
- a safe commit or the oldest commit if a safe commit is not found
- Throws:
java.io.IOException
-
commitDescription
public static java.lang.String commitDescription(org.apache.lucene.index.IndexCommit commit) throws java.io.IOExceptionReturns a description for a givenIndexCommit. This should be only used for logging and debugging.- Throws:
java.io.IOException
-
-