jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1461618 - in /jackrabbit/oak/trunk/oak-mongomk/src: main/java/org/apache/jackrabbit/mongomk/prototype/ test/java/org/apache/jackrabbit/mongomk/prototype/
Date Wed, 27 Mar 2013 14:48:53 GMT
Author: thomasm
Date: Wed Mar 27 14:48:52 2013
New Revision: 1461618

URL: http://svn.apache.org/r1461618
Log:
OAK-619 Lock-free MongoMK implementation (better error message, fix source merge error)

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/SimpleTest.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java?rev=1461618&r1=1461617&r2=1461618&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
Wed Mar 27 14:48:52 2013
@@ -199,7 +199,6 @@ public class Commit {
                     // some of the documents already exist:
                     // try to apply all changes one by one
                     for (UpdateOp op : newNodes) {
-                        op.unset(UpdateOp.ID);
                         if (op == commitRoot) {
                             // don't write the commit root just yet
                             // (because there might be a conflict)
@@ -260,14 +259,14 @@ public class Commit {
                 if (op.isNew) {
                     throw new MicroKernelException("The node " + 
                             op.path + " was already added in revision " + 
-                            newestRev);
+                            newestRev + "; before " + revision + "; document " + map);
                 }
                 if (mk.isRevisionNewer(newestRev, baseRevision)) {
                     throw new MicroKernelException("The node " + 
                             op.path + " was changed in revision " + 
                             newestRev + 
                             ", which was applied after the base revision " + 
-                            baseRevision);
+                            baseRevision + "; before " + revision + "; document " + map);
                 }
             }
         }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java?rev=1461618&r1=1461617&r2=1461618&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
Wed Mar 27 14:48:52 2013
@@ -187,6 +187,10 @@ public class MongoDocumentStore implemen
 
         for (Entry<String, Operation> entry : updateOp.changes.entrySet()) {
             String k = entry.getKey();
+            if (k.equals(UpdateOp.ID)) {
+                // avoid exception "Mod on _id not allowed"
+                continue;
+            }
             Operation op = entry.getValue();
             switch (op.type) {
                 case SET: {

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java?rev=1461618&r1=1461617&r2=1461618&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
Wed Mar 27 14:48:52 2013
@@ -895,8 +895,8 @@ public class MongoMK implements MicroKer
                 if (isRevisionNewer(before, propRev)) {
                     if (!onlyCommitted || isValidRevision(propRev, before, nodeMap)) {
                         newestRev = propRev;
+                        newestValue = valueMap.get(r);
                     }
-                    newestValue = valueMap.get(r);
                 }
             }
         }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/SimpleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/SimpleTest.java?rev=1461618&r1=1461617&r2=1461618&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/SimpleTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/SimpleTest.java
Wed Mar 27 14:48:52 2013
@@ -200,9 +200,11 @@ public class SimpleTest {
         MongoMK mk = createMK();
         String rev = mk.commit("/", "+\"test\":{\"x\":\"1\",\"child\": {}}", null, null);
         rev = mk.commit("/", "-\"test\"", rev, null);
-        rev = mk.commit("/", "+\"test\":{}", null, null);
+        rev = mk.commit("/", "+\"test\":{}  +\"test2\": {}", null, null);
         String test = mk.getNodes("/test", rev, 0, 0, Integer.MAX_VALUE, null);
         assertEquals("{\":childNodeCount\":0}", test);
+        String test2 = mk.getNodes("/test2", rev, 0, 0, Integer.MAX_VALUE, null);
+        assertEquals("{\":childNodeCount\":0}", test2);
         mk.dispose();
     }
     



Mime
View raw message