jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1583891 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document: MissingLastRevSeeker.java mongo/MongoMissingLastRevSeeker.java
Date Wed, 02 Apr 2014 06:13:43 GMT
Author: chetanm
Date: Wed Apr  2 06:13:42 2014
New Revision: 1583891

URL: http://svn.apache.org/r1583891
Log:
OAK-1295 - Recovery for missing _lastRev updates (WIP)

Fix the not query for acquiring lock

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java?rev=1583891&r1=1583890&r2=1583891&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
Wed Apr  2 06:13:42 2014
@@ -94,7 +94,7 @@ public class MissingLastRevSeeker {
         //This approach has a race condition where two different cluster nodes
         //can acquire the lock simultaneously.
         UpdateOp update = new UpdateOp(Integer.toString(clusterId), true);
-        update.set(ClusterNodeInfo.REV_RECOVERY_LOCK, RecoverLockState.ACQUIRED);
+        update.set(ClusterNodeInfo.REV_RECOVERY_LOCK, RecoverLockState.ACQUIRED.name());
         store.createOrUpdate(Collection.CLUSTER_NODES, update);
         return true;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java?rev=1583891&r1=1583890&r2=1583891&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
Wed Apr  2 06:13:42 2014
@@ -20,6 +20,7 @@
 package org.apache.jackrabbit.oak.plugins.document.mongo;
 
 import static com.google.common.collect.Iterables.transform;
+import static com.mongodb.QueryBuilder.start;
 import static org.apache.jackrabbit.oak.plugins.document.ClusterNodeInfo.RecoverLockState;
 
 import com.google.common.base.Function;
@@ -56,8 +57,7 @@ public class MongoMissingLastRevSeeker e
     @Override
     public ClusterNodeInfoDocument getClusterNodeInfo(final int clusterId) {
         DBObject query =
-                QueryBuilder
-                        .start(NodeDocument.ID).is(String.valueOf(clusterId)).get();
+                start(NodeDocument.ID).is(String.valueOf(clusterId)).get();
         DBCursor cursor =
                 getClusterNodeCollection().find(query)
                         .setReadPreference(ReadPreference.secondaryPreferred());
@@ -76,8 +76,7 @@ public class MongoMissingLastRevSeeker e
     public CloseableIterable<NodeDocument> getCandidates(final long startTime,
             final long endTime) {
         DBObject query =
-                QueryBuilder
-                        .start(NodeDocument.MODIFIED_IN_SECS).lessThanEquals(
+                start(NodeDocument.MODIFIED_IN_SECS).lessThanEquals(
                                 Commit.getModifiedInSecs(endTime))
                         .put(NodeDocument.MODIFIED_IN_SECS).greaterThanEquals(
                                 Commit.getModifiedInSecs(startTime))
@@ -99,9 +98,11 @@ public class MongoMissingLastRevSeeker e
 
     @Override
     public boolean acquireRecoveryLock(int clusterId) {
-        QueryBuilder query = QueryBuilder.start(Document.ID)
-                .is(Integer.toString(clusterId))
-                .put(ClusterNodeInfo.REV_RECOVERY_LOCK).is(RecoverLockState.ACQUIRED.name());
+        QueryBuilder query =
+                start().and(
+                        start(Document.ID).is(Integer.toString(clusterId)).get(),
+                        start(ClusterNodeInfo.REV_RECOVERY_LOCK).notEquals(RecoverLockState.ACQUIRED.name()).get()
+                );
 
         DBObject returnFields = new BasicDBObject();
         returnFields.put("_id", 1);



Mime
View raw message