You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/04/26 06:37:53 UTC
[GitHub] [bookkeeper] dlg99 commented on a diff in pull request #3192: Fix compaction throttle imprecise
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org