errose28 commented on code in PR #9015:
URL: https://github.com/apache/ozone/pull/9015#discussion_r2383692823
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerChecksumTreeManager.java:
##########
@@ -348,6 +307,33 @@ public ContainerProtos.ContainerChecksumInfo
read(ContainerData data) throws IOE
}
}
+ /**
+ * Called by the container scanner and reconciliation to update the merkle
tree persisted to disk.
+ * For live (non-deleted) blocks, only those in the incoming treeWriter
parameter are used.
+ * For deleted blocks, those in the incoming treeWriter are merged with
those on disk.
+ */
+ public ContainerProtos.ContainerChecksumInfo updateTree(ContainerData data,
ContainerMerkleTreeWriter treeWriter)
+ throws IOException {
+ return write(data, treeWriter::update);
+ }
+
+ /**
+ * Called by block deletion to update the merkle tree persisted to disk with
more deleted blocks.
+ * If a block with the same ID already exists in the tree, it is overwritten
as deleted with the checksum computed
+ * from the chunk checksums in the BlockData.
+ *
+ * The top level container data checksum is only updated if the existing
tree on disk already has this value present.
+ * This lets the block deleting service add blocks to the tree before the
scanner has reached the container, and that
+ * list of deleted blocks will not be mistaken for the list of all blocks
seen in the container.
+ * See {@link #hasDataChecksum(ContainerProtos.ContainerChecksumInfo)}.
+ */
+ public void addDeletedBlocks(ContainerData data, Collection<BlockData>
blocks) throws IOException {
Review Comment:
This seems more of a confusion with the class names than the method names.
Different classes have methods with the same name all the time, but if they
didn't come from the same interface then no conclusions can be drawn about what
they do the same or different. This is a composition relationship, not
inheritance.
I can see how `ContainerMerkleTreeWriter` is confusing considering it
generates protobuf but doesn't actually write it. Maybe later we could rename
it to `ContainerMerkleTreeGenerator` or similar to clear this up.
--
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]