mreutegg commented on a change in pull request #453:
URL: https://github.com/apache/jackrabbit-oak/pull/453#discussion_r781256843



##########
File path: 
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
##########
@@ -142,9 +143,29 @@ public int recover(int clusterId, long waitUntil)
         ClusterNodeInfoDocument nodeInfo = 
missingLastRevUtil.getClusterNodeInfo(clusterId);
 
         if (nodeInfo != null) {
+            // Check our own lease before running recovery for another
+            // clusterId (OAK-9656)
+            long now = revisionContext.getClock().getTime();
+            ClusterNodeInfoDocument me = null;
+            if (clusterId != revisionContext.getClusterId()) {
+                // Get leaseEnd from our own cluster node info, unless
+                // we are doing recovery on startup for the clusterId
+                // we want to acquire. Then it's fine to go ahead with
+                // an expired lease.
+                me = 
missingLastRevUtil.getClusterNodeInfo(revisionContext.getClusterId());
+            }
+            if (me != null && me.isRecoveryNeeded(now)) {

Review comment:
       Good suggestion. Will do.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to