You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2017/05/26 11:35:06 UTC

svn commit: r1796278 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/docu...

Author: chetanm
Date: Fri May 26 11:35:06 2017
New Revision: 1796278

URL: http://svn.apache.org/viewvc?rev=1796278&view=rev
Log:
OAK-6267 - Version restore fails if restore would not change bundling root but changes bundled nodes

Applying the patch and enabling the tests

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/document/VersionedDocumentBundlingTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java?rev=1796278&r1=1796277&r2=1796278&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java Fri May 26 11:35:06 2017
@@ -102,7 +102,7 @@ class CommitDiff implements NodeStateDif
         //TODO [bundling] Handle change of primaryType. Current approach would work
         //but if bundling was enabled for previous nodetype its "side effect"
         //would still impact even though new nodetype does not have bundling enabled
-        BundlingHandler child = bundlingHandler.childChanged(name, after);
+        BundlingHandler child = bundlingHandler.childChanged(name, before, after);
         return after.compareAgainstBaseState(before,
                 new CommitDiff(store, commit, child, builder, blobs));
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java?rev=1796278&r1=1796277&r2=1796278&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java Fri May 26 11:35:06 2017
@@ -126,17 +126,20 @@ public class BundlingHandler {
         return new BundlingHandler(registry, childContext, childPath, state);
     }
 
-    public BundlingHandler childChanged(String name, NodeState state){
+    public BundlingHandler childChanged(String name, NodeState before, NodeState after){
         String childPath = childPath(name);
         BundlingContext childContext;
         Matcher childMatcher = ctx.matcher.next(name);
         if (childMatcher.isMatch()) {
             childContext = createChildContext(childMatcher);
         } else {
-            childContext = getBundlorContext(childPath, state);
+            //Use the before state for looking up bundlor config
+            //as after state may have been recreated all together
+            //and bundlor config might have got lost
+            childContext = getBundlorContext(childPath, before);
         }
 
-        return new BundlingHandler(registry, childContext,  childPath, state);
+        return new BundlingHandler(registry, childContext,  childPath, after);
     }
 
     public boolean isBundlingRoot() {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java?rev=1796278&r1=1796277&r2=1796278&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java Fri May 26 11:35:06 2017
@@ -672,7 +672,6 @@ public class DocumentBundlingTest {
         merge(builder);
     }
 
-    @Ignore("OAK-6267")
     @Test
     public void recreatedBundledNode2() throws Exception{
         NodeBuilder builder = store.getRoot().builder();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/document/VersionedDocumentBundlingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/document/VersionedDocumentBundlingTest.java?rev=1796278&r1=1796277&r2=1796278&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/document/VersionedDocumentBundlingTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/document/VersionedDocumentBundlingTest.java Fri May 26 11:35:06 2017
@@ -117,8 +117,6 @@ public class VersionedDocumentBundlingTe
         assertNull(getNodeDocument(concat(versionedPath, "jcr:content")));
     }
 
-    //OAK-6267
-    @Ignore("OAK-6267")
     @Test
     public void restoreVersionedNode() throws Exception{
         String assetParentPath = "/bundlingtest/par";