jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1515846 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/segment/ test/java/org/apache/jackrabbit/oak/core/ test/java/org/apache/jackrabbit/oak/kernel/
Date Tue, 20 Aug 2013 15:33:17 GMT
Author: mduerig
Date: Tue Aug 20 15:33:16 2013
New Revision: 1515846

URL: http://svn.apache.org/r1515846
Log:
OAK-965: SegmentNodeState.equals fails with IllegalArgumentException
make SegmentNodeState comparison aware of different stores

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Template.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootFuzzIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java?rev=1515846&r1=1515845&r2=1515846&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
Tue Aug 20 15:33:16 2013
@@ -156,7 +156,7 @@ public class SegmentNodeState extends Ab
             } else {
                 Template template = getTemplate();
                 return template.equals(that.getTemplate())
-                        && template.compare(store, recordId, that.recordId);
+                        && template.compare(store, recordId, that.store, that.recordId);
             }
         } else {
             return super.equals(object);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Template.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Template.java?rev=1515846&r1=1515845&r2=1515846&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Template.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Template.java
Tue Aug 20 15:33:16 2013
@@ -26,13 +26,13 @@ import static org.apache.jackrabbit.oak.
 
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
+import com.google.common.base.Objects;
+import com.google.common.collect.Lists;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry;
@@ -41,9 +41,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
 
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-
 public class Template {
 
     static final String ZERO_CHILD_NODES = null;
@@ -348,14 +345,14 @@ public class Template {
     }
 
     public boolean compare(
-            SegmentStore store, RecordId thisId, RecordId thatId) {
+            SegmentStore thisStore, RecordId thisId, SegmentStore thatStore, RecordId thatId)
{
         checkNotNull(thisId);
         checkNotNull(thatId);
 
         // Compare properties
         for (int i = 0; i < properties.length; i++) {
-            PropertyState thisProperty = getProperty(store, thisId, i);
-            PropertyState thatProperty = getProperty(store, thatId, i);
+            PropertyState thisProperty = getProperty(thisStore, thisId, i);
+            PropertyState thatProperty = getProperty(thatStore, thatId, i);
             if (!thisProperty.equals(thatProperty)) {
                 return false;
             }
@@ -365,13 +362,13 @@ public class Template {
         if (hasNoChildNodes()) {
             return true;
         } else if (hasOneChildNode()) {
-            NodeState thisChild = getChildNode(childName, store, thisId);
-            NodeState thatChild = getChildNode(childName, store, thatId);
+            NodeState thisChild = getChildNode(childName, thisStore, thisId);
+            NodeState thatChild = getChildNode(childName, thatStore, thatId);
             return thisChild.equals(thatChild);
         } else {
             // TODO: Leverage the HAMT data structure for the comparison
-            MapRecord thisMap = getChildNodeMap(store, thisId);
-            MapRecord thatMap = getChildNodeMap(store, thatId);
+            MapRecord thisMap = getChildNodeMap(thisStore, thisId);
+            MapRecord thatMap = getChildNodeMap(thatStore, thatId);
             if (thisMap.getRecordId().equals(thatMap.getRecordId())) {
                 return true; // shortcut
             } else if (thisMap.size() != thatMap.size()) {
@@ -385,8 +382,8 @@ public class Template {
                     if (thatChild == null) {
                         return false;
                     } else if (!thisChild.equals(thatChild)
-                            && !new SegmentNodeState(store, thisChild).equals(
-                                    new SegmentNodeState(store, thatChild))) {
+                            && !new SegmentNodeState(thisStore, thisChild).equals(
+                                    new SegmentNodeState(thatStore, thatChild))) {
                         return false;
                     }
                 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootFuzzIT.java?rev=1515846&r1=1515845&r2=1515846&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootFuzzIT.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootFuzzIT.java
Tue Aug 20 15:33:16 2013
@@ -27,7 +27,6 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.core.RootFuzzIT.Operation.SetProperty;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -77,9 +76,6 @@ public class RootFuzzIT {
             RootFuzzIT.class.getSimpleName() + "-seed",
             new Random().nextInt());
 
-    private static boolean EXECUTE_SEGMENT_MK = Boolean.getBoolean(
-            RootFuzzIT.class.getSimpleName() + "-with-segment-mk");
-
     private static final Random random = new Random();
 
     private final NodeStoreFixture fixture;
@@ -123,9 +119,6 @@ public class RootFuzzIT {
 
     @Test
     public void fuzzTest() throws Exception {
-        // FIXME fails on SegmentMK. See OAK-965
-        assumeTrue(fixture != NodeStoreFixture.SEGMENT_MK || EXECUTE_SEGMENT_MK);
-
         for (Operation op : operations(OP_COUNT)) {
             log.info("{}", op);
             op.apply(root1);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java?rev=1515846&r1=1515845&r2=1515846&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
Tue Aug 20 15:33:16 2013
@@ -329,9 +329,6 @@ public class NodeStoreTest {
 
     @Test
     public void oak965() throws CommitFailedException {
-        // FIXME this fails on SegmentMK. See OAK-965
-        assumeTrue(fixture != NodeStoreFixture.SEGMENT_MK);
-
         NodeStore store1 = init(fixture.createNodeStore());
         NodeStore store2 = init(fixture.createNodeStore());
         try {



Mime
View raw message