jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1477501 - 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, 30 Apr 2013 08:10:36 GMT
Author: mreutegg
Date: Tue Apr 30 08:10:35 2013
New Revision: 1477501

URL: http://svn.apache.org/r1477501
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=1477501&r1=1477500&r2=1477501&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 30 08:10:35 2013
@@ -347,12 +347,28 @@ public class Commit {
             // no conflict is possible when there is no baseRevision
             return false;
         }
+        // did existence of node change after baseRevision?
+        @SuppressWarnings("unchecked")
+        Map<String, String> deleted = (Map<String, String>) nodeMap.get(UpdateOp.DELETED);
+        if (deleted != null) {
+            for (Map.Entry<String, String> entry : deleted.entrySet()) {
+                if (mk.isRevisionNewer(Revision.fromString(entry.getKey()), baseRevision))
{
+                    return true;
+                }
+            }
+        }
+
         for (Map.Entry<String, UpdateOp.Operation> entry : op.changes.entrySet()) {
             if (entry.getValue().type != UpdateOp.Operation.Type.SET_MAP_ENTRY) {
                 continue;
             }
             int idx = entry.getKey().indexOf('.');
             String name = entry.getKey().substring(0, idx);
+            if (UpdateOp.DELETED.equals(name)) {
+                // existence of node changed, this always conflicts with
+                // any other concurrent change
+                return true;
+            }
             if (!Utils.isPropertyName(name)) {
                 continue;
             }

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=1477501&r1=1477500&r2=1477501&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 30 08:10:35 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;
@@ -357,7 +356,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void addExistingNodeBranchLoses1() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);
@@ -374,7 +372,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void addExistingNodeBranchLoses2() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);
@@ -419,7 +416,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void removeRemovedNodeBranchLoses1() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);
@@ -436,7 +432,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void removeRemovedNodeBranchLoses2() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);
@@ -481,7 +476,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void removeChangedNodeBranchLoses1() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);
@@ -498,7 +492,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void removeChangedNodeBranchLoses2() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);
@@ -543,7 +536,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void changeRemovedNodeBranchLoses1() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);
@@ -560,7 +552,6 @@ public class ConflictTest extends BaseMo
     }
 
     @Test
-    @Ignore
     public void changeRemovedNodeBranchLoses2() {
         String rev = mk.commit("/", "+\"foo\":{}", null, null);
         String branchRev = mk.branch(rev);



Mime
View raw message