hemantk-12 commented on code in PR #4446:
URL: https://github.com/apache/ozone/pull/4446#discussion_r1147841323


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java:
##########
@@ -133,28 +134,35 @@ public RDBStore(File dbFile, ManagedDBOptions dbOptions,
       }
 
       //create checkpoints directory if not exists.
-      checkpointsParentDir =
+      if (!createCheckpointDirs) {
+        checkpointsParentDir = null;
+      } else {
+        checkpointsParentDir =
           Paths.get(dbLocation.getParent(), "db.checkpoints").toString();
-      File checkpointsDir = new File(checkpointsParentDir);
-      if (!checkpointsDir.exists()) {
-        boolean success = checkpointsDir.mkdir();
-        if (!success) {
-          throw new IOException(
-              "Unable to create RocksDB checkpoint directory: " +
-              checkpointsParentDir);
+        File checkpointsDir = new File(checkpointsParentDir);
+        if (!checkpointsDir.exists()) {
+          boolean success = checkpointsDir.mkdir();
+          if (!success) {
+            throw new IOException(
+                "Unable to create RocksDB checkpoint directory: " +
+                    checkpointsParentDir);
+          }
         }
       }
-
       //create snapshot directory if does not exist.
-      snapshotsParentDir = Paths.get(dbLocation.getParent(),
-          OM_SNAPSHOT_DIR).toString();
-      File snapshotsDir = new File(snapshotsParentDir);
-      if (!snapshotsDir.exists()) {
-        boolean success = snapshotsDir.mkdir();
-        if (!success) {
-          throw new IOException(
-              "Unable to create RocksDB snapshot directory: " +
-              snapshotsParentDir);
+      if (!createCheckpointDirs) {
+        snapshotsParentDir = null;
+      } else {
+        snapshotsParentDir = Paths.get(dbLocation.getParent(),

Review Comment:
   Same as above.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java:
##########
@@ -133,28 +134,35 @@ public RDBStore(File dbFile, ManagedDBOptions dbOptions,
       }
 
       //create checkpoints directory if not exists.
-      checkpointsParentDir =
+      if (!createCheckpointDirs) {
+        checkpointsParentDir = null;
+      } else {
+        checkpointsParentDir =

Review Comment:
   ```suggestion
         // Create checkpoints directory if not exists.
         Path checkpointsParentDirPath =
             Paths.get(dbLocation.getParent(), "db.checkpoints");
         checkpointsParentDir = checkpointsParentDirPath.toString();
         Files.createDirectories(checkpointsParentDirPath);
   ```
   
   Or 
   ```suggestion
         // Create checkpoints directory if not exists.
         Path checkpointsParentDirPath =
             Paths.get(dbLocation.getParent(), "db.checkpoints");
         checkpointsParentDir = checkpointsParentDirPath.toString();
         Files.createDirectory(checkpointsParentDirPath);
   ```
   
   Line 158-166 are duplicate of line 142-150. It can be replace by 
`Files.createDirectories()` or `Files.createDirectory()`.



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