Author: mreutegg Date: Mon Sep 23 11:18:00 2019 New Revision: 1867374 URL: http://svn.apache.org/viewvc?rev=1867374&view=rev Log: OAK-8629: Node bundling exposes hidden properties
Apply patch with fix and enable tests Modified: jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitDiffTest.java jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java Modified: jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java?rev=1867374&r1=1867373&r2=1867374&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java (original) +++ jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitDiff.java Mon Sep 23 11:18:00 2019 @@ -112,7 +112,6 @@ class CommitDiff implements NodeStateDif if (child.isBundlingRoot()) { commit.removeNode(child.getRootBundlePath(), before); } - setOrTouchChildrenFlag(child); return MISSING_NODE.compareAgainstBaseState(before, new CommitDiff(commit, child, builder, blobs)); } Modified: jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java?rev=1867374&r1=1867373&r2=1867374&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java (original) +++ jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java Mon Sep 23 11:18:00 2019 @@ -28,6 +28,7 @@ import org.apache.jackrabbit.oak.plugins import org.apache.jackrabbit.oak.spi.state.NodeState; import static com.google.common.base.Preconditions.checkNotNull; +import static org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.META_PROP_NAMES; import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE; import static org.apache.jackrabbit.oak.plugins.memory.PropertyStates.createProperty; @@ -177,14 +178,9 @@ public class BundlingHandler { } private static void removeDeletedChildProperties(NodeState state, BundlingContext childContext) { - childContext.removeProperty(DocumentBundlor.META_PROP_BUNDLING_PATH); + removeBundlingMetaProps(state, childContext); for (PropertyState ps : state.getProperties()){ - String propName = ps.getName(); - //In deletion never touch child status related meta props - //as they are not to be changed once set - if (!propName.startsWith(DocumentBundlor.HAS_CHILD_PROP_PREFIX)) { - childContext.removeProperty(ps.getName()); - } + childContext.removeProperty(ps.getName()); } } @@ -192,9 +188,10 @@ public class BundlingHandler { //Explicitly remove meta prop related to bundling as it would not //be part of normal listing of properties and hence would not be deleted //as part of diff - PropertyState bundlorConfig = state.getProperty(DocumentBundlor.META_PROP_PATTERN); - if (bundlorConfig != null){ - childContext.removeProperty(DocumentBundlor.META_PROP_PATTERN); + for (String name : META_PROP_NAMES) { + if (state.hasProperty(name)) { + childContext.removeProperty(name); + } } } Modified: jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitDiffTest.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitDiffTest.java?rev=1867374&r1=1867373&r2=1867374&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitDiffTest.java (original) +++ jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitDiffTest.java Mon Sep 23 11:18:00 2019 @@ -27,7 +27,6 @@ import org.apache.jackrabbit.oak.plugins import org.apache.jackrabbit.oak.spi.state.NodeBuilder; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -107,7 +106,6 @@ public class CommitDiffTest { assertThat(changes, hasKey(new Key(JCR_CONTENT + "/" + META_PROP_BUNDLING_PATH, r))); } - @Ignore("OAK-8629") @Test public void removeBundledNodeWithRoot() throws Exception { addTestFile(); @@ -133,7 +131,6 @@ public class CommitDiffTest { assertThat(changes, hasKey(new Key(JCR_CONTENT + "/" + META_PROP_BUNDLING_PATH, r))); } - @Ignore("OAK-8629") @Test public void removeBundledNode() throws Exception { addTestFile(); @@ -195,6 +192,5 @@ public class CommitDiffTest { content.setProperty(JCR_PRIMARYTYPE, "nt:resource", Type.NAME); content.setProperty(JCR_DATA, "test"); return builder.getNodeState(); - } } Modified: jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java?rev=1867374&r1=1867373&r2=1867374&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java (original) +++ jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java Mon Sep 23 11:18:00 2019 @@ -64,7 +64,6 @@ import org.h2.mvstore.WriteBuffer; import org.jetbrains.annotations.NotNull; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -830,7 +829,6 @@ public class DocumentBundlingTest { merge(builder); } - @Ignore("OAK-8629") @Test public void deleteAndRecreateAsNonBundledNode() throws Exception { NodeBuilder builder = store.getRoot().builder();