merlimat commented on code in PR #3544:
URL: https://github.com/apache/bookkeeper/pull/3544#discussion_r999998403


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java:
##########
@@ -1080,7 +1083,19 @@ journalFormatVersionToWrite, getBufferedChannelBuilder(),
                             
.registerSuccessfulEvent(MathUtils.elapsedNanos(dequeueStartTime), 
TimeUnit.NANOSECONDS);
                     }
 
-                    if (numEntriesToFlush == 0) {
+                    if (localQueueEntries.isEmpty()) {
+                        queue.drainTo(localQueueEntries);
+                    }
+
+                    if (!localQueueEntries.isEmpty()) {

Review Comment:
   Very good points. I actually think we should do it both before the `poll()` 
and the `take()`. 
   
   @zymap @hangc0276  PTAL again



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