pvillard31 commented on code in PR #11575:
URL: https://github.com/apache/nifi/pull/11575#discussion_r3828447696


##########
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:
   Can we catch and log an automatic checkpoint failure here, since the journal 
and snapshot update have already succeeded and propagating the exception makes 
callers roll back or retry an update that was already applied? Can we also add 
a test that injects a checkpoint failure and verifies that the completed update 
still reports success?



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