szetszwo commented on code in PR #9689:
URL: https://github.com/apache/ozone/pull/9689#discussion_r2775630224


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java:
##########
@@ -374,8 +375,25 @@ private StorageContainerManager(OzoneConfiguration conf,
     // This is for the clusters which got upgraded from older version of Ozone.
     // We enable Ratis by default.
     if (!scmStorageConfig.isSCMHAEnabled()) {
+      // Create Ratis snapshot directory for upgrade scenario.
+      // This must be done before initializeRatis() since SCMSnapshotProvider
+      // expects the directory to already exist during normal startup.
+      String snapshotDir = SCMHAUtils.getSCMRatisSnapshotDirectory(conf);
+      HddsUtils.createDir(snapshotDir);
+      LOG.info("Upgrade: created Ratis snapshot directory: {}", snapshotDir);
+
       // Since we have initialized Ratis, we have to reload StorageConfig
       scmStorageConfig = initializeRatis(conf);
+    } else {
+      // For clusters upgraded from older versions that already have 
SCMHAEnabled
+      // but may not have the snapshot directory (it was auto-created by

Review Comment:
   How could older versions with HA do not have the snapshot directory?
   
   I guess it is possible only if older versions is non-HA, then it does not 
have the snapshot directory.  Further, if it is updated to a newer version and 
enable HA at the same time, it could hit this case.  Is it the case?



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java:
##########
@@ -1340,6 +1376,7 @@ private static SCMStorageConfig 
initializeRatis(OzoneConfiguration conf)
     final SCMHANodeDetails haDetails = SCMHANodeDetails.loadSCMHAConfig(conf, 
storageConfig);
     SCMRatisServerImpl.initialize(storageConfig.getClusterID(),
         storageConfig.getScmId(), haDetails.getLocalNodeDetails(), conf);
+

Review Comment:
   Please revert this  whitespace change..



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAManagerImpl.java:
##########
@@ -95,8 +95,10 @@ public SCMHAManagerImpl(final ConfigurationSource conf,
   }
 
   @VisibleForTesting
-  protected SCMSnapshotProvider newScmSnapshotProvider(StorageContainerManager 
storageContainerManager) {
-    return new SCMSnapshotProvider(storageContainerManager.getConfiguration(),
+  protected SCMSnapshotProvider newScmSnapshotProvider(
+      StorageContainerManager storageContainerManager) {
+    return new SCMSnapshotProvider(
+        storageContainerManager.getConfiguration(),

Review Comment:
   This has only whitespace changes.  Please revert them.



-- 
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