Index: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/InitialContentMigrator.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/InitialContentMigrator.java (revision d76aeb04babb7174016a05e083bbbb6a7636ce81) +++ oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/InitialContentMigrator.java (date 1537953513000) @@ -45,6 +45,7 @@ import java.util.Set; import static org.apache.jackrabbit.oak.spi.cluster.ClusterRepositoryInfo.CLUSTER_CONFIG_NODE; +import static org.apache.jackrabbit.oak.spi.namespace.NamespaceConstants.NAMESPACES_PATH; public class InitialContentMigrator { @@ -52,7 +53,8 @@ private static final String CLUSTER_ID = System.getProperty("oak.composite.seed.clusterId", "1"); - private static final Set DEFAULT_IGNORED_PATHS = ImmutableSet.of("/" + CLUSTER_CONFIG_NODE); + private static final Set DEFAULT_IGNORED_PATHS = ImmutableSet + .of("/" + CLUSTER_CONFIG_NODE, NAMESPACES_PATH); private static final Logger LOG = LoggerFactory.getLogger(InitialContentMigrator.class); Index: oak-core/src/main/java/org/apache/jackrabbit/oak/InitialContent.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/InitialContent.java (revision d76aeb04babb7174016a05e083bbbb6a7636ce81) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/InitialContent.java (date 1537952610000) @@ -83,6 +83,9 @@ system.child(VersionConstants.JCR_ACTIVITIES) .setProperty(JCR_PRIMARYTYPE, VersionConstants.REP_ACTIVITIES, Type.NAME); + Namespaces.setupNamespaces(system); + } else { + NodeBuilder system = builder.getChildNode(JCR_SYSTEM); Namespaces.setupNamespaces(system); } Index: oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/InitialContentMigratorTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/InitialContentMigratorTest.java (revision d76aeb04babb7174016a05e083bbbb6a7636ce81) +++ oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/InitialContentMigratorTest.java (date 1537953477000) @@ -16,7 +16,11 @@ */ package org.apache.jackrabbit.oak.composite; +import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM; import static org.apache.jackrabbit.oak.spi.cluster.ClusterRepositoryInfo.CLUSTER_CONFIG_NODE; +import static org.apache.jackrabbit.oak.spi.namespace.NamespaceConstants.NAMESPACES_PATH; +import static org.apache.jackrabbit.oak.spi.namespace.NamespaceConstants.REP_NAMESPACES; +import static org.apache.jackrabbit.oak.spi.namespace.NamespaceConstants.REP_NSDATA; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -29,13 +33,19 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; +import org.apache.jackrabbit.oak.InitialContent; +import org.apache.jackrabbit.oak.OakInitializer; import org.apache.jackrabbit.oak.api.CommitFailedException; import org.apache.jackrabbit.oak.plugins.document.DocumentMK; import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore; import org.apache.jackrabbit.oak.plugins.document.DocumentStore; import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore; import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore; +import org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider; +import org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider; import org.apache.jackrabbit.oak.spi.commit.CommitInfo; +import org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider; +import org.apache.jackrabbit.oak.spi.commit.EditorHook; import org.apache.jackrabbit.oak.spi.commit.EmptyHook; import org.apache.jackrabbit.oak.spi.mount.Mount; import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider; @@ -47,6 +57,35 @@ public class InitialContentMigratorTest { + @Test + public void noMigrationJcrNamespaces() throws Exception { + NodeStore seed = new MemoryNodeStore(); + EditorHook hook = new EditorHook( + new CompositeEditorProvider(new NamespaceEditorProvider(), new TypeEditorProvider())); + OakInitializer.initialize(seed, new InitialContent(), hook); + + MemoryNodeStore target = new MemoryNodeStore(); + NodeBuilder targetRootBuilder = target.getRoot().builder(); + targetRootBuilder.child(JCR_SYSTEM); + target.merge(targetRootBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY); + + MountInfoProvider mip = Mounts.newBuilder().mount("seed", "/first").build(); + + // perform migration + InitialContentMigrator icm = new InitialContentMigrator(target, seed, mip.getMountByName("seed")); + icm.migrate(); + + NodeState targetRoot = target.getRoot(); + assertFalse(NAMESPACES_PATH + "/" + REP_NSDATA + " should not be copied", + targetRoot.getChildNode(JCR_SYSTEM).getChildNode(REP_NAMESPACES).hasChildNode(REP_NSDATA)); + OakInitializer.initialize(target, new InitialContent(), hook); + + targetRoot = target.getRoot(); + assertTrue(NAMESPACES_PATH + "/" + REP_NSDATA + " should have been created", + targetRoot.getChildNode(JCR_SYSTEM).getChildNode(REP_NAMESPACES).hasChildNode(REP_NSDATA)); + + } + @Test public void migrateContentWithCheckpoints() throws IOException, CommitFailedException {