rich7420 commented on code in PR #11499:
URL: https://github.com/apache/ozone/pull/11499#discussion_r4255124880


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/BaseFileChecksumHelper.java:
##########
@@ -370,26 +384,63 @@ DataChecksum.Type toHadoopChecksumType() {
     }
   }
 
+  private long consumedBlockLength(int blockIndex, long sumBlockLengths) {
+    OmKeyLocationInfo block = keyLocationInfos.get(blockIndex);
+    if (blockIndex < keyLocationInfos.size() - 1) {
+      return block.getLength();
+    }
+    return Math.min(length - sumBlockLengths, block.getLength());

Review Comment:
   With two 10-byte blocks and a requested length of 5, this returns -5 and 
causes `CrcComposer.update()` to throw. Could we preserve the existing 
block-length handling for this empty-block fix and use 
`blockChecksumBuf.getLength() == 0` before composition?



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

Reply via email to