wenwj0 commented on code in PR #4502:
URL: https://github.com/apache/hbase/pull/4502#discussion_r917866985


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java:
##########
@@ -625,11 +625,12 @@ HFileBlock unpack(HFileContext fileContext, FSReader 
reader) throws IOException
         : reader.getDefaultBlockDecodingContext();
       // Create a duplicated buffer without the header part.
       ByteBuff dup = this.buf.duplicate();
-      dup.position(this.headerSize());
+      int totalChecksumBytes = totalChecksumBytes();
+      dup.position(this.headerSize()).limit(dup.limit() - totalChecksumBytes);
       dup = dup.slice();
       // Decode the dup into unpacked#buf
-      ctx.prepareDecoding(unpacked.getOnDiskSizeWithoutHeader(),
-        unpacked.getUncompressedSizeWithoutHeader(), 
unpacked.getBufferWithoutHeader(true), dup);
+      ctx.prepareDecoding(unpacked.getOnDiskSizeWithoutHeader() - 
totalChecksumBytes,

Review Comment:
   Yes, In the method prepareDecoding(), the uncompressedSizeWithoutHeader 
doesn't include checkSum bytes, the onDiskSizeWithoutHeader does include 
checkSum bytes. Because in the method getBufferWithoutHeader(boolean 
withChecksum),  we can see that the withCheckSum value is true.



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

Reply via email to