You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/12/16 18:16:32 UTC

[GitHub] [ozone] bharatviswa504 commented on a change in pull request #1688: HDDS-3378. OzoneManager group init failed because of incorrect snapshot directory location.

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org