hemantk-12 commented on code in PR #7474:
URL: https://github.com/apache/ozone/pull/7474#discussion_r2029174144
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerChecksumTreeManager.java:
##########
@@ -146,33 +150,31 @@ public void markBlocksAsDeleted(KeyValueContainerData
data, Collection<Long> del
}
}
- public ContainerDiffReport diff(KeyValueContainerData thisContainer,
+ /**
+ * Compares the checksum info of the container with the peer's checksum info
and returns a report of the differences.
+ * @param thisChecksumInfo The checksum info of the container on this
datanode.
+ * @param peerChecksumInfo The checksum info of the container on the peer
datanode.
+ */
+ public ContainerDiffReport diff(ContainerProtos.ContainerChecksumInfo
thisChecksumInfo,
ContainerProtos.ContainerChecksumInfo
peerChecksumInfo) throws
StorageContainerException {
ContainerDiffReport report = new ContainerDiffReport();
try {
captureLatencyNs(metrics.getMerkleTreeDiffLatencyNS(), () -> {
- Preconditions.assertNotNull(thisContainer, "Container data is null");
+ Preconditions.assertNotNull(thisChecksumInfo, "Our checksum info is
null");
Preconditions.assertNotNull(peerChecksumInfo, "Peer checksum info is
null");
- Optional<ContainerProtos.ContainerChecksumInfo>
thisContainerChecksumInfo = read(thisContainer);
- if (!thisContainerChecksumInfo.isPresent()) {
- throw new StorageContainerException("The container #" +
thisContainer.getContainerID() +
- " doesn't have container checksum",
ContainerProtos.Result.IO_EXCEPTION);
- }
-
- if (thisContainer.getContainerID() !=
peerChecksumInfo.getContainerID()) {
+ if (thisChecksumInfo.getContainerID() !=
peerChecksumInfo.getContainerID()) {
throw new StorageContainerException("Container Id does not match for
container "
Review Comment:
After discussing and giving it a second thought, it is alright to leave it
as it is because the `diff` function is working as top-level function. Here,
the exception wrapping indicates that the container diff failed and explains
the reason.
--
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]