jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1468327 - in /jackrabbit/oak/trunk/oak-mongomk/src: main/java/org/apache/jackrabbit/mongomk/Commit.java test/java/org/apache/jackrabbit/mongomk/ConflictTest.java
Date Tue, 16 Apr 2013 08:45:43 GMT
Author: mreutegg
Date: Tue Apr 16 08:45:43 2013
New Revision: 1468327

URL: http://svn.apache.org/r1468327
Log:
OAK-619 Lock-free MongoMK implementation
- Improved conflict handling

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/Commit.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ConflictTest.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/Commit.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/Commit.java?rev=1468327&r1=1468326&r2=1468327&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/Commit.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/Commit.java
Tue Apr 16 08:45:43 2013
@@ -273,10 +273,9 @@ public class Commit {
                             newestRev + "; before " + revision + "; document " + map);
                 }
                 if (mk.isRevisionNewer(newestRev, baseRevision)
-                        && isConflicting(map, op)) {
+                        && (op.isDelete || isConflicting(map, op))) {
                     throw new MicroKernelException("The node " + 
-                            op.path + " was changed in revision " + 
-                            newestRev + 
+                            op.path + " was changed in revision " + newestRev +
                             ", which was applied after the base revision " + 
                             baseRevision + "; before " + revision + "; document " + map);
                 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ConflictTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ConflictTest.java?rev=1468327&r1=1468326&r2=1468327&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ConflictTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ConflictTest.java
Tue Apr 16 08:45:43 2013
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.mongomk;
 
 import org.apache.jackrabbit.mk.api.MicroKernelException;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.junit.Assert.fail;
@@ -120,7 +119,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void removeChangedNode() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         mk.commit("/foo", "^\"prop\":\"value\"", rev, null);
@@ -145,4 +143,25 @@ public class ConflictTest extends BaseMo
             // expected
         }
     }
+
+    @Test
+    public void nonConflictingChangeProperty() {
+        String rev = mk.commit("/", "+\"foo\":{\"prop1\":\"value\", \"prop2\":\"value\"}",
null, null);
+        mk.commit("/foo", "^\"prop1\":\"bar\"", rev, null);
+        mk.commit("/foo", "^\"prop2\":\"baz\"", rev, null);
+    }
+
+    @Test
+    public void nonConflictingAddProperty() {
+        String rev = mk.commit("/", "+\"foo\":{\"prop1\":\"value\"}", null, null);
+        mk.commit("/foo", "^\"prop1\":\"bar\"", rev, null);
+        mk.commit("/foo", "^\"prop2\":\"baz\"", rev, null);
+    }
+
+    @Test
+    public void nonConflictingRemoveProperty() {
+        String rev = mk.commit("/", "+\"foo\":{\"prop1\":\"value\", \"prop2\":\"value\"}",
null, null);
+        mk.commit("/foo", "^\"prop1\":\"bar\"", rev, null);
+        mk.commit("/foo", "^\"prop2\":null", rev, null);
+    }
 }



Mime
View raw message