This is an automated email from the ASF dual-hosted git repository. merlimat pushed a commit to branch branch-4.18 in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit 8fe398538c3a1d1f1a5c2549705003c99eb05378 Author: Matteo Merli <[email protected]> AuthorDate: Tue Jul 14 08:26:05 2026 -0700 Skip journal flush-trace loop when debug logging is disabled (#4835) (cherry picked from commit bcb3e708f1cab463ed83972658122531757948e4) --- .../main/java/org/apache/bookkeeper/bookie/Journal.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java index ad637f0156..44c392ed3f 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java @@ -1151,14 +1151,17 @@ public class Journal implements CheckpointSource { journalFlushWatcher.stop().elapsed(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS); // Trace the lifetime of entries through persistence - for (QueueEntry e : toFlush) { - if (e != null) { - log.debug() - .attr("ledgerId", e.ledgerId) - .attr("entryId", e.entryId) - .log("Written and queuing for flush"); + RecyclableArrayList<QueueEntry> flushedEntries = toFlush; + log.debug(e -> { + for (QueueEntry entry : flushedEntries) { + if (entry != null) { + log.debug() + .attr("ledgerId", entry.ledgerId) + .attr("entryId", entry.entryId) + .log("Written and queuing for flush"); + } } - } + }); journalStats.getForceWriteBatchEntriesStats() .registerSuccessfulValue(numEntriesToFlush);
