markap14 commented on code in PR #11575:
URL: https://github.com/apache/nifi/pull/11575#discussion_r3828608281
##########
nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/SequentialAccessWriteAheadLog.java:
##########
@@ -127,10 +158,20 @@ public int update(final Collection<T> records, final
boolean forceSync) throws I
}
snapshot.update(records);
+
+ maxJournalSizeReached = maxJournalBytes != null &&
journal.getBytesWritten() >= maxJournalBytes;
} finally {
journalReadLock.unlock();
}
+ // The checkpoint requires the write lock, so it must be performed
only after the read lock has been released. Because the
+ // journal may be rolled over by another thread in the meantime, the
checkpoint verifies that the journal is still large
+ // enough to warrant rolling over.
+ if (maxJournalSizeReached) {
+ logger.debug("Checkpointing Write-Ahead Log at {} because its
journal has reached the maximum size of {} bytes", storageDirectory,
maxJournalBytes);
+ checkpointIfJournalExceedsLimit();
Review Comment:
[Grok 4.6] Agreed — the update is already in the journal and snapshot by
then, so a checkpoint failure should not fail the caller. Automatic checkpoint
exceptions are now caught and logged, and
`testUpdateSucceedsWhenAutomaticCheckpointFails` injects a failure on
`onGlobalSync` to verify the update still succeeds and the records remain
recoverable.
@pvillard31
--
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]