ChenSammi commented on code in PR #7830:
URL: https://github.com/apache/ozone/pull/7830#discussion_r1952171446


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolume.java:
##########
@@ -599,35 +600,47 @@ private void cleanTmpDiskCheckDir() {
   @Override
   public synchronized VolumeCheckResult check(@Nullable Boolean unused)
       throws Exception {
+    DiskCheckUtil.ReadWriteStatus readWriteStatus = 
DiskCheckUtil.checkPermissions(storageDir);
+
     boolean directoryChecksPassed =
-        DiskCheckUtil.checkExistence(storageDir) &&
-        DiskCheckUtil.checkPermissions(storageDir);
+        DiskCheckUtil.checkExistence(storageDir);
     // If the directory is not present or has incorrect permissions, fail the
     // volume immediately. This is not an intermittent error.
-    if (!directoryChecksPassed) {
+    if (!directoryChecksPassed || readWriteStatus == 
DiskCheckUtil.ReadWriteStatus.READ_FAIL) {
       if (Thread.currentThread().isInterrupted()) {
         throw new InterruptedException("Directory check of volume " + this +
             " interrupted.");
       }
       return VolumeCheckResult.FAILED;
     }
 
+    if (readWriteStatus == DiskCheckUtil.ReadWriteStatus.WRITE_FAIL) {
+      setState(VolumeState.READ_ONLY);

Review Comment:
   @ashishkumar50 , thanks for working on this.  
   Based on above checkReadWrite() implementation, it looks like WRITE_FAIL 
doesn't guarantee read will pass. 
   
   Back to the container schema V2 age, when disk is full, it's not able to 
read blocks because rocksdb cannot be opened due to disk full.  Now container 
V3 is used, thing will be better. But it's not sure whether read block can 
succeed or not. 



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