jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1470864 - /jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoMK.java
Date Tue, 23 Apr 2013 09:41:48 GMT
Author: mreutegg
Date: Tue Apr 23 09:41:48 2013
New Revision: 1470864

URL: http://svn.apache.org/r1470864
Log:
OAK-619 Lock-free MongoMK implementation
- Fix warning when a revision is not yet committed
- Remove synchronization for nodeExists() and getNodes()

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoMK.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoMK.java?rev=1470864&r1=1470863&r2=1470864&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoMK.java
Tue Apr 23 09:41:48 2013
@@ -147,7 +147,7 @@ public class MongoMK implements MicroKer
     /**
      * The last known head revision. This is the last-known revision.
      */
-    private Revision headRevision;
+    private volatile Revision headRevision;
     
     private Thread backgroundThread;
     
@@ -459,6 +459,10 @@ public class MongoMK implements MicroKer
         if (isCommitted(rev, readRevision, revisions)) {
             validRevisions.add(rev);
             return true;
+        } else if (revisions != null && revisions.containsKey(rev.toString())) {
+            // rev is in revisions map of this node, but not committed
+            // no need to check _commitRoot field
+            return false;
         }
         // check commit root
         @SuppressWarnings("unchecked")
@@ -749,7 +753,7 @@ public class MongoMK implements MicroKer
     }
 
     @Override
-    public synchronized boolean nodeExists(String path, String revisionId)
+    public boolean nodeExists(String path, String revisionId)
             throws MicroKernelException {
         revisionId = revisionId != null ? revisionId : headRevision.toString();
         Revision rev = Revision.fromString(stripBranchRevMarker(revisionId));
@@ -765,7 +769,7 @@ public class MongoMK implements MicroKer
     }
 
     @Override
-    public synchronized String getNodes(String path, String revisionId, int depth,
+    public String getNodes(String path, String revisionId, int depth,
             long offset, int maxChildNodes, String filter)
             throws MicroKernelException {
         if (depth != 0) {



Mime
View raw message