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


##########
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:
   This is a very frequently called code, can we avoid creating a new object?
   I think the throttler can be safely passed down the call chain into this 
method. 



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