jojochuang commented on a change in pull request #2937:
URL: https://github.com/apache/ozone/pull/2937#discussion_r827649188



##########
File path: 
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/BaseFileChecksumHelper.java
##########
@@ -186,6 +207,35 @@ private FileChecksum makeMd5CrcResult() {
         crcPerBlock, fileMD5);
   }
 
+  FileChecksum makeCompositeCrcResult() throws IOException {
+    long blockSizeHint = 0;
+    if (keyLocationInfos.size() > 0) {
+      blockSizeHint = keyLocationInfos.get(0).getLength();
+    }
+    CrcComposer crcComposer =
+        CrcComposer.newCrcComposer(DataChecksum.Type.CRC32, blockSizeHint);
+    byte[] blockChecksumBytes = blockChecksumBuf.getData();
+
+    long sumBlockLengths = 0;
+    for (int i = 0; i < keyLocationInfos.size(); ++i) {
+      OmKeyLocationInfo block = keyLocationInfos.get(i);
+      // For every LocatedBlock, we expect getBlockSize()
+      // to accurately reflect the number of file bytes digested in the block
+      // checksum.
+      sumBlockLengths += block.getLength();

Review comment:
       Thanks for checking this out. As far as I understand, Ozone is simpler 
in how blocks are written, so we shouldn't need to worry about the possibility 
of mismatch between on-disk length and requested length.
   
   I'll go ahead and remove it.




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