You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f7e7387
Browse filesBrowse the repository at this point in the historyBrowse files
NIFI-16599 Preserve FlowFile order across restart for queues that are swapping (#11936)
- Restore FlowFiles in priority order on recovery when there are no swap files, sharing the logic used when swap files exist
- Keep the place of a swap file rewritten by a selective drop by reusing the timestamp and counter of the replaced swap file
- Add a counter to swap file names so that swap files written in the same millisecond are recovered in the order written
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: David Handermann <exceptionfactory@apache.org>
Copy file name to clipboardExpand all lines: nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java
+70-21Lines changed: 70 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,7 @@
64
64
importjava.util.Objects;
65
65
importjava.util.Set;
66
66
importjava.util.UUID;
67
+
importjava.util.concurrent.atomic.AtomicLong;
67
68
importjava.util.regex.Matcher;
68
69
importjava.util.regex.Pattern;
69
70
importjava.util.stream.Collectors;
@@ -86,6 +87,7 @@ public class FileSystemSwapManager implements FlowFileSwapManager {
// Swap files are recovered in the order of the timestamp and counter in their names, so the new swap file takes those of the swap file that it replaces
* Returns the counter from a swap file name of the form "<timestamp>-<queue identifier>-<counter>-<random uuid>". The counter orders
481
+
* swap files that were written within the same millisecond.
482
+
*
483
+
* @param fullyQualifiedFilename the swap location
484
+
* @return the counter from the swap file name, or 0 if the name does not contain a counter
Copy file name to clipboardExpand all lines: nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java
+50-30Lines changed: 50 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1180,8 +1180,8 @@ private SwapFileDropResult processSwapFileForDrop(final String swapLocation, fin
Copy file name to clipboardExpand all lines: nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/TestFileSystemSwapManager.java
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,24 @@ public void testFailureOnRepoSwapOut() throws IOException {
0 commit comments