taklwu commented on code in PR #4414:
URL: https://github.com/apache/hbase/pull/4414#discussion_r868786596


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/BlockIOUtils.java:
##########
@@ -284,6 +311,10 @@ private static boolean preadWithExtraDirectly(ByteBuff 
buff, FSDataInputStream d
         throw e;
       }
       if (ret < 0) {
+        if (remain <= extraLen) {
+          // break for the "extra data" when hitting end of stream and 
remaining is necessary
+          break;

Review Comment:
   you got it right. e.g. if there is a case that we read a HFile does not have 
the trailer, and just end with the last data block, we're hitting here. 
   
   I added that because I found this logic exists already as part of 
BlockIOUtils#readWithExtraOnHeap (see below).
   
   
https://github.com/apache/hbase/blob/f6e9d3e1dd6546663319c436286ab58dd0e731ed/hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/BlockIOUtils.java#L154-L156
 
   
   I thought this is good for handling some case that we don't expect 
automatically, but we can remove it to let the premature EOF throws back to the 
client. 



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