zymap commented on code in PR #4030:
URL: https://github.com/apache/bookkeeper/pull/4030#discussion_r1413317151
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedReadChannel.java:
##########
@@ -103,4 +106,17 @@ public synchronized void clear() {
readBuffer.clear();
}
+ public synchronized void close() throws IOException {
+ if (closed) {
+ return;
+ }
+
+ readBufferStartPosition = Long.MIN_VALUE;
+ ReferenceCountUtil.release(readBuffer);
+
+ // BufferedReadChannel is not response for fileChannel close.
+
+ closed = true;
Review Comment:
Move the closed to the first step?
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java:
##########
@@ -101,6 +101,10 @@ public synchronized void close() throws IOException {
if (closed) {
return;
}
+
+ super.close();
+ writeBufferStartPosition.set(0);
Review Comment:
Should we close and reset the position after setting the closed to true?
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -899,6 +899,7 @@ private BufferedReadChannel getChannelForLogId(long
entryLogId) throws IOExcepti
// We set the position of the write buffer of this buffered channel to
Long.MAX_VALUE
// so that there are no overlaps with the write buffer while reading
fc = new BufferedReadChannel(newFc, conf.getReadBufferBytes());
+
Review Comment:
```suggestion
```
--
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]