errose28 commented on code in PR #8904:
URL: https://github.com/apache/ozone/pull/8904#discussion_r2255445364


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1485,6 +1485,10 @@ public void markContainerUnhealthy(Container container, 
ScanResult reason)
       container.writeUnlock();
     }
     updateContainerChecksumFromMetadataIfNeeded(container);
+    // For unhealthy containers, trigger an async on-demand scan to build 
container merkle tree,
+    // as the metadata-based tree may not be reliable due to potential data 
corruption.
+    containerSet.scanContainerWithoutGap(containerID, "Unhealthy container 
scan");

Review Comment:
   We should put the scan [after this 
line](https://github.com/apache/ozone/blob/11cc4520e77527be1a91f119de82c7f4167273c9/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/HddsDispatcher.java#L410)
 and remove the TODO above. So on the write path when container moves out of 
open state, we initially generate the tree from metadata in 
`markContainerUnhealthy`. Once that is done we trigger the on-demand scan async 
to do a more robust check in the background.
   
   The current location is confusing because it triggers a scan from a method 
already called by the scanner. The second call should get dropped because the 
container is unhealthy so this method returns early, but it's still not ideal.



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