eolivelli commented on a change in pull request #889: BP-14 Implementation of
WriteFlag.DEFERRED_SYNC on Journal
URL: https://github.com/apache/bookkeeper/pull/889#discussion_r164272733
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
##########
@@ -959,19 +979,31 @@ public void run() {
}
journalFlushWatcher.reset().start();
bc.flush(false);
+
+ for (int i = 0; i < toFlush.size(); i++) {
+ QueueEntry entry = toFlush.get(i);
+ if (entry != null && (!syncData ||
entry.ackBeforeSync)) {
+ toFlush.set(i, null);
+ numEntriesToFlush--;
+ cbThreadPool.execute(entry);
+ }
+ }
+
lastFlushPosition = bc.position();
journalFlushStats.registerSuccessfulEvent(
journalFlushWatcher.stop().elapsed(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS);
// Trace the lifetime of entries through
persistence
if (LOG.isDebugEnabled()) {
for (QueueEntry e : toFlush) {
- LOG.debug("Written and queuing for flush
Ledger: {} Entry: {}",
- e.ledgerId, e.entryId);
+ if (e != null) {
+ LOG.debug("Written and queuing for
flush Ledger: {} Entry: {}",
+ e.ledgerId, e.entryId);
+ }
}
}
-
forceWriteBatchEntriesStats.registerSuccessfulValue(toFlush.size());
+
forceWriteBatchEntriesStats.registerSuccessfulValue(numEntriesToFlush);
Review comment:
it is better, will revert, thanks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services