errose28 commented on code in PR #8604:
URL: https://github.com/apache/ozone/pull/8604#discussion_r2223775965
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/helpers/KeyValueContainerUtil.java:
##########
@@ -295,17 +294,24 @@ public static void
parseKVContainerData(KeyValueContainerData kvContainerData,
}
}
- private static void populateContainerDataChecksum(KeyValueContainerData
kvContainerData) {
+ private static void loadAndSetContainerDataChecksum(KeyValueContainerData
kvContainerData,
+ Table<String, Long>
metadataTable) throws IOException {
if (kvContainerData.isOpen()) {
return;
}
+ Long containerDataChecksum =
metadataTable.get(kvContainerData.getContainerDataChecksumKey());
+ if (containerDataChecksum != null) {
+ kvContainerData.setDataChecksum(containerDataChecksum);
+ return;
+ }
+
try {
- Optional<ContainerChecksumInfo> optionalContainerChecksumInfo =
ContainerChecksumTreeManager
- .readChecksumInfo(kvContainerData);
- if (optionalContainerChecksumInfo.isPresent()) {
- ContainerChecksumInfo containerChecksumInfo =
optionalContainerChecksumInfo.get();
-
kvContainerData.setDataChecksum(containerChecksumInfo.getContainerMerkleTree().getDataChecksum());
+ ContainerChecksumInfo containerChecksumInfo =
ContainerChecksumTreeManager.readChecksumInfo(kvContainerData);
+ if (containerChecksumInfo != null) {
+ containerDataChecksum =
containerChecksumInfo.getContainerMerkleTree().getDataChecksum();
+ kvContainerData.setDataChecksum(containerDataChecksum);
Review Comment:
The file may exist without a merkle tree per #8565. If the file does not
have a tree, we should not call the setter on the container data so the
`needsDataChecksum` method added there returns true.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerChecksumTreeManager.java:
##########
@@ -350,7 +351,8 @@ private Lock getLock(long containerID) {
*/
public Optional<ContainerProtos.ContainerChecksumInfo> read(ContainerData
data) throws IOException {
try {
- return captureLatencyNs(metrics.getReadContainerMerkleTreeLatencyNS(),
() -> readChecksumInfo(data));
+ return captureLatencyNs(metrics.getReadContainerMerkleTreeLatencyNS(),
() ->
+ Optional.ofNullable(readChecksumInfo(data)));
Review Comment:
Let's merge #8565 first and address the conflicts here.
--
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]