xichen01 commented on code in PR #6113:
URL: https://github.com/apache/ozone/pull/6113#discussion_r1540646539


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java:
##########
@@ -257,14 +258,23 @@ public synchronized VolumeCheckResult check(@Nullable 
Boolean unused)
     VolumeCheckResult result = super.check(unused);
 
     DatanodeConfiguration df = 
getConf().getObject(DatanodeConfiguration.class);
+    if (isDbLoadFailure()) {
+      LOG.warn("Volume {} failed to access RocksDB: RocksDB parent directory 
is null, " +
+          "the volume might not have been loaded properly.", getStorageDir());
+      return VolumeCheckResult.FAILED;
+    }
     if (result != VolumeCheckResult.HEALTHY ||
         !df.getContainerSchemaV3Enabled() || !isDbLoaded()) {
       return result;
     }
 
     // Check that per-volume RocksDB is present.
-    File dbFile = new File(dbParentDir, CONTAINER_DB_NAME);
-    if (!dbFile.exists() || !dbFile.canRead()) {
+    File dbFile = dbParentDir == null ? null : new File(dbParentDir, 
CONTAINER_DB_NAME);

Review Comment:
   `dbParentDir` will non-null if it passes L261 check. I think this can be 
simplified



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