Class MissingLastRevSeeker
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.MissingLastRevSeeker
-
- Direct Known Subclasses:
MongoMissingLastRevSeeker,RDBMissingLastRevSeeker
public class MissingLastRevSeeker extends Object
Utilities to retrieve _lastRev missing update candidates.
-
-
Constructor Summary
Constructors Constructor Description MissingLastRevSeeker(DocumentStore store, Clock clock)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanacquireRecoveryLock(int clusterId, int recoveredBy)Acquire a recovery lock for the given cluster node info document.@NotNull Iterable<ClusterNodeInfoDocument>getAllClusters()Gets the clusters which potentially need _lastRev recovery.@NotNull Iterable<NodeDocument>getCandidates(long startTime)Get the candidates with modified time greater than or equal the specifiedstartTimein milliseconds since the start of the epoch.@Nullable ClusterNodeInfoDocumentgetClusterNodeInfo(int clusterId)Gets the cluster node info for the given cluster node id.NodeDocumentgetRoot()booleanisRecoveryNeeded()Returnstrueif any of the cluster node info documents satisfiesClusterNodeInfoDocument.isRecoveryNeeded(long)where the passed timestamp is the current time.booleanisRecoveryNeeded(@NotNull ClusterNodeInfoDocument nodeInfo)Deprecated.useClusterNodeInfoDocument.isRecoveryNeeded(long)instead.voidreleaseRecoveryLock(int clusterId, boolean success)Releases the recovery lock on the givenclusterId.
-
-
-
Field Detail
-
clock
protected final Clock clock
-
-
Constructor Detail
-
MissingLastRevSeeker
public MissingLastRevSeeker(DocumentStore store, Clock clock)
-
-
Method Detail
-
getAllClusters
@NotNull public @NotNull Iterable<ClusterNodeInfoDocument> getAllClusters()
Gets the clusters which potentially need _lastRev recovery.- Returns:
- the clusters
-
getClusterNodeInfo
@Nullable public @Nullable ClusterNodeInfoDocument getClusterNodeInfo(int clusterId)
Gets the cluster node info for the given cluster node id.- Parameters:
clusterId- the cluster id- Returns:
- the cluster node info
-
getCandidates
@NotNull public @NotNull Iterable<NodeDocument> getCandidates(long startTime)
Get the candidates with modified time greater than or equal the specifiedstartTimein milliseconds since the start of the epoch.- Parameters:
startTime- the start time in milliseconds.- Returns:
- the candidates
-
acquireRecoveryLock
public boolean acquireRecoveryLock(int clusterId, int recoveredBy)Acquire a recovery lock for the given cluster node info document. This method may break a lock when it determines the cluster node holding the recovery lock is no more active or its lease expired.- Parameters:
clusterId- id of the cluster that is going to be recoveredrecoveredBy- id of cluster doing the recovery- Returns:
- whether the lock has been acquired
-
releaseRecoveryLock
public void releaseRecoveryLock(int clusterId, boolean success)Releases the recovery lock on the givenclusterId. Ifsuccessistrue, the state of the cluster node entry is reset, otherwise it is left as is. That is, for a cluster node which requires recovery and the recovery process failed, the state will still be active, when this release method is called withsuccessset tofalse.- Parameters:
clusterId- the id of the cluster node that was recovered.success- whether recovery was successful.
-
getRoot
public NodeDocument getRoot()
-
isRecoveryNeeded
public boolean isRecoveryNeeded()
Returnstrueif any of the cluster node info documents satisfiesClusterNodeInfoDocument.isRecoveryNeeded(long)where the passed timestamp is the current time.- Returns:
trueif any of the cluster nodes need recovery,falseotherwise.
-
isRecoveryNeeded
public boolean isRecoveryNeeded(@NotNull @NotNull ClusterNodeInfoDocument nodeInfo)Deprecated.useClusterNodeInfoDocument.isRecoveryNeeded(long)instead.
-
-