sijie 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_r161957542
##########
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:
if you are changing to report `numEntriesToFlush`, you should also change
`batchSize`. otherwise, you will have inconsistent metrics.
However I don't think you need to change this here. because
`forceWriteBatchEntries` and `forceWriteBatchBytes` are measuring how many
entries/bytes per batch that submitted to force write queue. ackBeforeSync is
only changing the ack behavior, it doesn't change the flushing or force write
behavior. so we shouldn't change the metric here.
In that sense, I don't see a need of `numEntriesToFlush`.
----------------------------------------------------------------
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