bharatviswa504 commented on a change in pull request #1688:
URL: https://github.com/apache/ozone/pull/1688#discussion_r544518541



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -464,16 +465,33 @@ private OzoneManager(OzoneConfiguration conf) throws 
IOException,
             " must be defined.");
       }
       OmUtils.createOMDir(omRatisDirectory);
+
       // Create Ratis snapshot dir
       omRatisSnapshotDir = OmUtils.createOMDir(
           OzoneManagerRatisServer.getOMRatisSnapshotDirectory(configuration));
 
+      // Before starting ratis server check, if previous installation has
+      // snapshot directory in Ratis storage directory if so, move it to
+      // snapshot directory.
+      File[] dirs = new File(omRatisDirectory).listFiles();
+
+      if (dirs != null) {
+        for (File dir : dirs) {
+          if (dir.isDirectory() && dir.getName().equals("snapshot")) {
+            FileUtils.moveDirectory(dir.toPath(), omRatisSnapshotDir.toPath());
+            break;

Review comment:
       Yes, it can be, thanks for the suggestion updated it.

##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -464,16 +465,33 @@ private OzoneManager(OzoneConfiguration conf) throws 
IOException,
             " must be defined.");
       }
       OmUtils.createOMDir(omRatisDirectory);
+
       // Create Ratis snapshot dir
       omRatisSnapshotDir = OmUtils.createOMDir(
           OzoneManagerRatisServer.getOMRatisSnapshotDirectory(configuration));
 
+      // Before starting ratis server check, if previous installation has
+      // snapshot directory in Ratis storage directory if so, move it to
+      // snapshot directory.
+      File[] dirs = new File(omRatisDirectory).listFiles();
+
+      if (dirs != null) {
+        for (File dir : dirs) {
+          if (dir.isDirectory() && dir.getName().equals("snapshot")) {

Review comment:
       Done




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

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