sarvekshayr commented on code in PR #9135:
URL: https://github.com/apache/ozone/pull/9135#discussion_r2512924895


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/replicas/ContainerStateVerifier.java:
##########
@@ -101,11 +104,15 @@ public BlockVerificationResult 
verifyBlock(DatanodeDetails datanode, OmKeyLocati
       }
       replicaCheckMsg.append(", Container state in SCM is 
").append(containerInfoToken.getContainerState());
 
-      if (pass) {
-        return BlockVerificationResult.pass();
-      } else {
-        return BlockVerificationResult.failCheck(replicaCheckMsg.toString());
+      String replicationStatus = 
checkReplicationStatus(keyLocation.getContainerID());
+      replicaCheckMsg.append(", ").append(replicationStatus);
+      if (replicationStatus.contains("REPLICATION_CHECK_FAILED")) {
+        pass = false;
       }
+
+      // Always return failCheck to include replication status information in 
the output
+      // This allows users to see replication health status even when 
container state is good
+      return BlockVerificationResult.failCheck(replicaCheckMsg.toString());

Review Comment:
   The replication status check evaluates container-level health by counting 
healthy replicas across all datanodes. Therefore, when a container is 
`UNDER_REPLICATED` or `OVER_REPLICATED`, this information should be reflected 
in all replica outputs, not just the unhealthy ones.
   
   Revert to the previous implementation which correctly checked:
   ```
   if (replicationStatus.contains("UNDER_REPLICATED") || 
       replicationStatus.contains("OVER_REPLICATED") ||
       replicationStatus.contains("REPLICATION_CHECK_FAILED")) {
     pass = false;
   }
   ```
   or
   ```
   if (replicationStatus.contains("HEALTHY_REPLICATION")) {
     pass = true;
   }
   ```
   With this change, the robot test fix shared will work as expected. 



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