This is an automated email from the ASF dual-hosted git repository.

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 056c16a383 NIFI-15244 Adjusting update logic to prevent rollback from 
duplicating FlowFiles upon journal update failure
056c16a383 is described below

commit 056c16a38300af51463ae1188576009cf2f54ba8
Author: Ofek Rotem <[email protected]>
AuthorDate: Sun Dec 21 15:14:55 2025 +0200

    NIFI-15244 Adjusting update logic to prevent rollback from duplicating 
FlowFiles upon journal update failure
    
    Signed-off-by: Pierre Villard <[email protected]>
    
    This closes #10677.
---
 .../main/java/org/apache/nifi/wali/LengthDelimitedJournal.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java
 
b/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java
index 1d3eadbebf..db087e1d41 100644
--- 
a/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java
+++ 
b/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java
@@ -230,14 +230,14 @@ public class LengthDelimitedJournal<T> implements 
WriteAheadJournal<T> {
 
     @Override
     public void update(final Collection<T> records, final RecordLookup<T> 
recordLookup) throws IOException {
-        if (!headerWritten) {
-            throw new IllegalStateException("Cannot update journal file " + 
journalFile + " because no header has been written yet.");
-        }
-
         if (records.isEmpty()) {
             return;
         }
 
+        if (!headerWritten) {
+            throw new IllegalStateException("Cannot update journal file " + 
journalFile + " because no header has been written yet.");
+        }
+
         checkState();
 
         File overflowFile = null;

Reply via email to