test_class.file: oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/InitialContentMigratorTest.java
test_class.identifier: InitialContentMigratorTest
test_case.body: @Test
      public void migrateContentWithCheckpoints() throws IOException, CommitFailedException {
  
          // 1. populate the seed store with
          // .
          // \- first
          // \- second
          // \- third
          //
          // 2. checkpoint before adding the third node
          //
          // 3. the mount only includes the '/first' path, so only the
          // 'second' and 'third' nodes should be available
  
          MemoryNodeStore seed = new MemoryNodeStore();
          NodeBuilder root = seed.getRoot().builder();
          root.child("first");
          root.child("second");
          seed.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY);
          String checkpoint1 = seed.checkpoint(TimeUnit.MINUTES.toMillis(10));
          
          root = seed.getRoot().builder();
          root.child("third");
          seed.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY);
          
          MemoryNodeStore target = new MemoryNodeStore();
          NodeBuilder targetRootBuilder = target.getRoot().builder();
          targetRootBuilder.child(CLUSTER_CONFIG_NODE);
          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();
          
          // verify that the 'second' and 'third' nodes are visible in the migrated store
          assertFalse("Node /first should not have been migrated", targetRoot.hasChildNode("first"));
          assertTrue("Node /second should have been migrated", targetRoot.hasChildNode("second"));
          assertTrue("Node /third should have been migrated", targetRoot.hasChildNode("third"));
          assertTrue(CLUSTER_CONFIG_NODE  + " should be retained", targetRoot.hasChildNode(CLUSTER_CONFIG_NODE));
  
          // verify that the 'second' node is visible in the migrated store when retrieving the checkpoint
          NodeState checkpointTargetRoot = target.retrieve(checkpoint1);
          assertFalse("Node /first should not have been migrated", checkpointTargetRoot.hasChildNode("first"));
          assertTrue("Node /second should have been migrated", checkpointTargetRoot.hasChildNode("second"));
          assertFalse("Node /third should not be visible from the migrated checkpoint", checkpointTargetRoot.hasChildNode("third"));
  
      }
test_case.class_method_signature: InitialContentMigratorTest.migrateContentWithCheckpoints()
test_case.full_signature: @Test public void migrateContentWithCheckpoints()
test_case.identifier: migrateContentWithCheckpoints
test_case.invocations: builder getRoot child child merge checkpoint toMillis builder getRoot child merge builder getRoot child merge build mount newBuilder getMountByName migrate getRoot assertFalse hasChildNode assertTrue hasChildNode assertTrue hasChildNode assertTrue hasChildNode retrieve assertFalse hasChildNode assertTrue hasChildNode assertFalse hasChildNode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void migrateContentWithCheckpoints()
focal_class.declarator: LOG_NODE_COPY = Integer.getInteger("oak.upgrade.logNodeCopy", 10000)
focal_class.modifier: private static final
focal_class.original_string: private static final int LOG_NODE_COPY = Integer.getInteger("oak.upgrade.logNodeCopy", 10000);
focal_class.type: int
focal_class.var_name: LOG_NODE_COPY
focal_class.declarator: CLUSTER_ID = System.getProperty("oak.composite.seed.clusterId", "1")
focal_class.modifier: private static final
focal_class.original_string: private static final String CLUSTER_ID = System.getProperty("oak.composite.seed.clusterId", "1");
focal_class.type: String
focal_class.var_name: CLUSTER_ID
focal_class.declarator: DEFAULT_IGNORED_PATHS = ImmutableSet.of("/" + CLUSTER_CONFIG_NODE)
focal_class.modifier: private static final
focal_class.original_string: private static final Set<String> DEFAULT_IGNORED_PATHS = ImmutableSet.of("/" + CLUSTER_CONFIG_NODE);
focal_class.type: Set<String>
focal_class.var_name: DEFAULT_IGNORED_PATHS
focal_class.declarator: LOG = LoggerFactory.getLogger(InitialContentMigrator.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(InitialContentMigrator.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: targetNodeStore
focal_class.modifier: private final
focal_class.original_string: private final NodeStore targetNodeStore;
focal_class.type: NodeStore
focal_class.var_name: targetNodeStore
focal_class.declarator: seedNodeStore
focal_class.modifier: private final
focal_class.original_string: private final NodeStore seedNodeStore;
focal_class.type: NodeStore
focal_class.var_name: seedNodeStore
focal_class.declarator: seedMount
focal_class.modifier: private final
focal_class.original_string: private final Mount seedMount;
focal_class.type: Mount
focal_class.var_name: seedMount
focal_class.declarator: includePaths
focal_class.modifier: private final
focal_class.original_string: private final Set<String> includePaths;
focal_class.type: Set<String>
focal_class.var_name: includePaths
focal_class.declarator: excludePaths
focal_class.modifier: private final
focal_class.original_string: private final Set<String> excludePaths;
focal_class.type: Set<String>
focal_class.var_name: excludePaths
focal_class.declarator: fragmentPaths
focal_class.modifier: private final
focal_class.original_string: private final Set<String> fragmentPaths;
focal_class.type: Set<String>
focal_class.var_name: fragmentPaths
focal_class.declarator: excludeFragments
focal_class.modifier: private final
focal_class.original_string: private final Set<String> excludeFragments;
focal_class.type: Set<String>
focal_class.var_name: excludeFragments
focal_class.file: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/InitialContentMigrator.java
focal_class.identifier: InitialContentMigrator
focal_class.class_method_signature: InitialContentMigrator.InitialContentMigrator(NodeStore targetNodeStore, NodeStore seedNodeStore, Mount seedMount)
focal_class.full_signature: public  InitialContentMigrator(NodeStore targetNodeStore, NodeStore seedNodeStore, Mount seedMount)
focal_class.identifier: InitialContentMigrator
focal_class.modifiers: public
focal_class.parameters: (NodeStore targetNodeStore, NodeStore seedNodeStore, Mount seedMount)
focal_class.signature:  InitialContentMigrator(NodeStore targetNodeStore, NodeStore seedNodeStore, Mount seedMount)
focal_class.class_method_signature: InitialContentMigrator.isTargetInitialized()
focal_class.full_signature: private boolean isTargetInitialized()
focal_class.identifier: isTargetInitialized
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isTargetInitialized()
focal_class.class_method_signature: InitialContentMigrator.waitForInitialization()
focal_class.full_signature: private void waitForInitialization()
focal_class.identifier: waitForInitialization
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void waitForInitialization()
focal_class.class_method_signature: InitialContentMigrator.migrate()
focal_class.full_signature: public void migrate()
focal_class.identifier: migrate
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void migrate()
focal_class.class_method_signature: InitialContentMigrator.doMigrate()
focal_class.full_signature: protected void doMigrate()
focal_class.identifier: doMigrate
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void doMigrate()
focal_class.class_method_signature: InitialContentMigrator.markMigrationAsDone()
focal_class.full_signature: private void markMigrationAsDone()
focal_class.identifier: markMigrationAsDone
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void markMigrationAsDone()
focal_class.class_method_signature: InitialContentMigrator.copyDiffToTarget(NodeState before, NodeState after, NodeState targetRoot)
focal_class.full_signature: private NodeState copyDiffToTarget(NodeState before, NodeState after, NodeState targetRoot)
focal_class.identifier: copyDiffToTarget
focal_class.modifiers: private
focal_class.parameters: (NodeState before, NodeState after, NodeState targetRoot)
focal_class.return: NodeState
focal_class.signature: NodeState copyDiffToTarget(NodeState before, NodeState after, NodeState targetRoot)
focal_class.class_method_signature: InitialContentMigrator.wrapNodeState(NodeState nodeState, boolean logPaths)
focal_class.full_signature: private NodeState wrapNodeState(NodeState nodeState, boolean logPaths)
focal_class.identifier: wrapNodeState
focal_class.modifiers: private
focal_class.parameters: (NodeState nodeState, boolean logPaths)
focal_class.return: NodeState
focal_class.signature: NodeState wrapNodeState(NodeState nodeState, boolean logPaths)
focal_class.class_method_signature: InitialContentMigrator.stripPatternCharacters(String pathPattern)
focal_class.full_signature: private static String stripPatternCharacters(String pathPattern)
focal_class.identifier: stripPatternCharacters
focal_class.modifiers: private static
focal_class.parameters: (String pathPattern)
focal_class.return: String
focal_class.signature: String stripPatternCharacters(String pathPattern)
focal_class.class_method_signature: InitialContentMigrator.substringBefore(String subject, char stopCharacter)
focal_class.full_signature: private static String substringBefore(String subject, char stopCharacter)
focal_class.identifier: substringBefore
focal_class.modifiers: private static
focal_class.parameters: (String subject, char stopCharacter)
focal_class.return: String
focal_class.signature: String substringBefore(String subject, char stopCharacter)
focal_method.body: public void migrate() throws IOException, CommitFailedException {
          if (isTargetInitialized()) {
              LOG.info("The target is already initialized, no need to copy the seed mount");
          } else if (targetNodeStore instanceof Clusterable) {
              Clusterable dns = (Clusterable) targetNodeStore;
              String clusterId = dns.getInstanceId();
              LOG.info("The target isn't initialized and the cluster id = {}.", clusterId);
              if (CLUSTER_ID.equals(clusterId)) {
                  LOG.info("This cluster id {} is configured to initialized the repository.", CLUSTER_ID);
                  doMigrate();
              } else {
                  LOG.info("Waiting until the repository is initialized by instance {}.", CLUSTER_ID);
                  waitForInitialization();
              }
          } else {
              LOG.info("Initializing the default mount.");
              doMigrate();
          }
      }
focal_method.class_method_signature: InitialContentMigrator.migrate()
focal_method.full_signature: public void migrate()
focal_method.identifier: migrate
focal_method.invocations: isTargetInitialized info getInstanceId info equals info doMigrate info waitForInitialization info doMigrate
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void migrate()