horizonzy commented on code in PR #4021:
URL: https://github.com/apache/bookkeeper/pull/4021#discussion_r1264680939
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedReadChannel.java:
##########
@@ -86,14 +86,25 @@ public synchronized int read(ByteBuf dest, long pos, int
length) throws IOExcept
// here we reached eof.
break;
} else {
- // We don't have it in the buffer, so put necessary data in
the buffer
- readBufferStartPosition = currentPosition;
int readBytes = 0;
- if ((readBytes =
validateAndGetFileChannel().read(readBuffer.internalNioBuffer(0, readCapacity),
- currentPosition)) <= 0) {
+ try {
+ // We don't have it in the buffer, so put necessary data
in the buffer
+ readBufferStartPosition = currentPosition;
Review Comment:
We can check the `pos` in advance; if it is negative, throw an exception
directly. This pr will invalidate the read buffer cache. Maybe we can reuse the
read buffer cache at next time.
--
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]