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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerChecksumTreeManager.java:
##########
@@ -99,12 +104,18 @@ public void writeContainerDataTree(ContainerData data, 
ContainerMerkleTree tree)
         checksumInfoBuilder = 
ContainerProtos.ContainerChecksumInfo.newBuilder();
       }
 
+      ContainerProtos.ContainerMerkleTree treeProto = 
captureLatencyNs(metrics.getCreateMerkleTreeLatencyNS(),
+          tree::toProto);
       checksumInfoBuilder
           .setContainerID(containerID)
-          
.setContainerMerkleTree(captureLatencyNs(metrics.getCreateMerkleTreeLatencyNS(),
 tree::toProto));
+          .setContainerMerkleTree(treeProto);
       write(data, checksumInfoBuilder.build());
-      LOG.debug("Data merkle tree for container {} updated", containerID);
+      // If write succeeds, update the checksum in memory. Otherwise 0 will be 
used to indicate the metadata failure.
+      dataChecksum = treeProto.getDataChecksum();
+      LOG.debug("Data merkle tree for container {} updated with container 
checksum {}", containerID, dataChecksum);
     } finally {
+      // Even if persisting the tree fails, we should still update the data 
checksum in memory to report back to SCM.
+      data.setDataChecksum(dataChecksum);

Review Comment:
   This is handled in the latest commits.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/BackgroundContainerDataScanner.java:
##########
@@ -92,6 +92,13 @@ public void scanContainer(Container<?> c)
     if (result.isDeleted()) {
       LOG.debug("Container [{}] has been deleted during the data scan.", 
containerId);
     } else {
+      // Merkle tree write failure should not abort the scanning process. 
Continue marking the scan as completed.
+      try {
+        checksumManager.writeContainerDataTree(containerData, 
result.getDataTree());
+      } catch (IOException ex) {
+        LOG.error("Failed to write container merkle tree for container {}", 
containerId, ex);

Review Comment:
   This is handled in the latest commits.



-- 
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: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to