Package org.apache.solr.core
Class IndexDeletionPolicyWrapper
- java.lang.Object
-
- org.apache.lucene.index.IndexDeletionPolicy
-
- org.apache.solr.core.IndexDeletionPolicyWrapper
-
public final class IndexDeletionPolicyWrapper extends org.apache.lucene.index.IndexDeletionPolicyA wrapper for an IndexDeletionPolicy instance.Provides features for looking up IndexCommit given a version. Allows reserving index commit points for certain amounts of time to support features such as index replication or snapshooting directly out of a live index directory.
NOTE: The
Object.clone()method returns this in order to make thisIndexDeletionPolicyinstance trackable acrossIndexWriterinstantiations. This is correct because each core has its ownIndexDeletionPolicyand never has more than one openIndexWriter.- See Also:
IndexDeletionPolicy
-
-
Constructor Summary
Constructors Constructor Description IndexDeletionPolicyWrapper(org.apache.lucene.index.IndexDeletionPolicy deletionPolicy, SolrSnapshotMetaDataManager snapshotMgr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.index.IndexCommitgetCommitPoint(Long gen)Map<Long,org.apache.lucene.index.IndexCommit>getCommits()Gets the commit points for the index.static longgetCommitTimestamp(org.apache.lucene.index.IndexCommit commit)org.apache.lucene.index.IndexCommitgetLatestCommit()Gets the most recent commit pointorg.apache.lucene.index.IndexDeletionPolicygetWrappedDeletionPolicy()voidonCommit(List<? extends org.apache.lucene.index.IndexCommit> list)Internal use for Lucene...voidonInit(List<? extends org.apache.lucene.index.IndexCommit> list)Internal use for Lucene...voidreleaseCommitPoint(Long indexCommitGen)Release a previously saved commit pointvoidsaveCommitPoint(Long indexCommitGen)Permanently prevent this commit point from being deleted.voidsetReserveDuration(Long indexGen, long reserveTime)Set the duration for which commit point is to be reserved by the deletion policy.
-
-
-
Constructor Detail
-
IndexDeletionPolicyWrapper
public IndexDeletionPolicyWrapper(org.apache.lucene.index.IndexDeletionPolicy deletionPolicy, SolrSnapshotMetaDataManager snapshotMgr)
-
-
Method Detail
-
getLatestCommit
public org.apache.lucene.index.IndexCommit getLatestCommit()
Gets the most recent commit pointIt is recommended to reserve a commit point for the duration of usage so that it is not deleted by the underlying deletion policy
- Returns:
- the most recent commit point
-
getWrappedDeletionPolicy
public org.apache.lucene.index.IndexDeletionPolicy getWrappedDeletionPolicy()
-
setReserveDuration
public void setReserveDuration(Long indexGen, long reserveTime)
Set the duration for which commit point is to be reserved by the deletion policy.- Parameters:
indexGen- gen of the commit point to be reservedreserveTime- time in milliseconds for which the commit point is to be reserved
-
saveCommitPoint
public void saveCommitPoint(Long indexCommitGen)
Permanently prevent this commit point from being deleted. A counter is used to allow a commit point to be correctly saved and released multiple times.
-
releaseCommitPoint
public void releaseCommitPoint(Long indexCommitGen)
Release a previously saved commit point
-
onInit
public void onInit(List<? extends org.apache.lucene.index.IndexCommit> list) throws IOException
Internal use for Lucene... do not explicitly call.- Specified by:
onInitin classorg.apache.lucene.index.IndexDeletionPolicy- Throws:
IOException
-
onCommit
public void onCommit(List<? extends org.apache.lucene.index.IndexCommit> list) throws IOException
Internal use for Lucene... do not explicitly call.- Specified by:
onCommitin classorg.apache.lucene.index.IndexDeletionPolicy- Throws:
IOException
-
getCommitPoint
public org.apache.lucene.index.IndexCommit getCommitPoint(Long gen)
- Parameters:
gen- the gen of the commit point- Returns:
- a commit point corresponding to the given version
-
getCommits
public Map<Long,org.apache.lucene.index.IndexCommit> getCommits()
Gets the commit points for the index. This map instance may change between commits and commit points may be deleted. It is recommended to reserve a commit point for the duration of usage- Returns:
- a Map of version to commit points
-
getCommitTimestamp
public static long getCommitTimestamp(org.apache.lucene.index.IndexCommit commit) throws IOException- Throws:
IOException
-
-