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: [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]