hangc0276 commented on code in PR #3192:
URL: https://github.com/apache/bookkeeper/pull/3192#discussion_r858372194


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedReadChannel.java:
##########
@@ -95,9 +98,10 @@ public synchronized int read(ByteBuf dest, long pos, int 
length) throws IOExcept
                     throw new IOException("Reading from filechannel returned a 
non-positive value. Short read.");
                 }
                 readBuffer.writerIndex(readBytes);
+                bytesFetchedFromFile += readBytes;
             }
         }
-        return (int) (currentPosition - pos);
+        return new ImmutablePair<> ((int) (currentPosition - pos), 
bytesFetchedFromFile);

Review Comment:
   Good catch. I'm considering how to avoiding creating new object. 
   The `BufferedReadChannel.read` method is synchronized, we should use 
throttle in the read method to block it when throttled, otherwise, it will 
block other threading calling.  I still have no good idea about 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]

Reply via email to