sadanand48 commented on code in PR #10917:
URL: https://github.com/apache/ozone/pull/10917#discussion_r3700140762


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMRatisSnapshots.java:
##########
@@ -597,6 +606,111 @@ public void 
testInstallSnapshotFromLeaderFailedDownloadCleanupSucceeds()
     followerOM.getOmSnapshotProvider().setInjector(null);
   }
 
+  /**
+   * Regression test for bootstrap when leader logs are purged: checkpoint 
install
+   * must proceed during {@code BOOTSTRAPPING} with the default v2 checkpoint 
API.
+   * Stops once download starts so the test targets the BOOTSTRAPPING guard 
only.
+   */
+  @Test
+  public void testBootstrapInstallSnapshotDuringBootstrapping() throws 
Exception {
+    IOUtils.closeQuietly(client);
+    if (cluster != null) {
+      cluster.shutdown();
+    }
+
+    OzoneConfiguration bootstrapConf = new OzoneConfiguration();
+    
bootstrapConf.setInt(OzoneConfigKeys.OZONE_CLIENT_FAILOVER_MAX_ATTEMPTS_KEY, 5);
+    bootstrapConf.setInt(OMConfigKeys.OZONE_OM_RATIS_LOG_PURGE_GAP, 
BOOTSTRAP_LOG_PURGE_GAP);
+    
bootstrapConf.setLong(OMConfigKeys.OZONE_OM_RATIS_SNAPSHOT_AUTO_TRIGGER_THRESHOLD_KEY,
+        SNAPSHOT_THRESHOLD);
+    bootstrapConf.setStorageSize(OMConfigKeys.OZONE_OM_RATIS_SEGMENT_SIZE_KEY, 
16,
+        StorageUnit.KB);
+    
bootstrapConf.setStorageSize(OMConfigKeys.OZONE_OM_RATIS_SEGMENT_PREALLOCATED_SIZE_KEY,
+        16, StorageUnit.KB);
+
+    OzoneManagerRatisServerConfig omRatisConf =
+        bootstrapConf.getObject(OzoneManagerRatisServerConfig.class);
+    omRatisConf.setLogAppenderWaitTimeMin(10);
+    bootstrapConf.setFromObject(omRatisConf);
+
+    cluster = (MiniOzoneHAClusterImpl) 
MiniOzoneCluster.newHABuilder(bootstrapConf)
+        .setOMServiceId(BOOTSTRAP_OM_SERVICE_ID)
+        .setNumOfOzoneManagers(2)
+        .setNumDatanodes(1)
+        .build();
+    cluster.waitForClusterToBeReady();
+
+    client = OzoneClientFactory.getRpcClient(BOOTSTRAP_OM_SERVICE_ID, 
bootstrapConf);
+    objectStore = client.getObjectStore();
+    String bootstrapVolume = uniqueObjectName("volume");
+    String bootstrapBucket = uniqueObjectName("bucket");
+    objectStore.createVolume(bootstrapVolume);
+    OzoneVolume volume = objectStore.getVolume(bootstrapVolume);
+    volume.createBucket(bootstrapBucket,
+        BucketArgs.newBuilder().setBucketLayout(TEST_BUCKET_LAYOUT).build());
+    ozoneBucket = volume.getBucket(bootstrapBucket);
+
+    OzoneManager leader = cluster.getOMLeader();
+    writeKeysToIncreaseLogIndex(leader.getOmRatisServer(), 
BOOTSTRAP_TARGET_LOG_INDEX);
+    assertThat(leader.getRatisSnapshotIndex())
+        .as("leader should have purged early logs")
+        .isGreaterThan((long) BOOTSTRAP_LOG_PURGE_GAP);
+
+    LogCapturer omLog = LogCapturer.captureLogs(OzoneManager.class);
+    LogCapturer stateMachineLog =
+        LogCapturer.captureLogs(OzoneManagerStateMachine.class);
+    LogCapturer snapshotProviderLog =
+        LogCapturer.captureLogs(RDBSnapshotProvider.class);
+    String newNodeId = "omNode-bootstrap-ratis-snapshots";
+    ExecutorService executor = Executors.newSingleThreadExecutor();
+    Future<?> bootstrapFuture = executor.submit(() -> {
+      try {
+        cluster.bootstrapOzoneManager(newNodeId);
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+    });
+
+    try {
+      waitForBootstrapCheckpointInstallToStart(omLog, snapshotProviderLog);

Review Comment:
   This was deliberate on my part as I think I found another issue when 
continuing with the full bootstrap.  Just investigated it today and its due to 
the wrong path setting in MiniOzoneCluster implementation. I've done a test fix 
now to get the CI passing , however we could make the path creation more robust 
in HDDS-16069 for such cases.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to