Mark Payne created NIFI-16344:
---------------------------------

             Summary: Selective FlowFile drop can reorder swapped queue contents
                 Key: NIFI-16344
                 URL: https://issues.apache.org/jira/browse/NIFI-16344
             Project: Apache NiFi
          Issue Type: Bug
            Reporter: Mark Payne
            Assignee: Mark Payne


{{SwappablePriorityQueue.dropFlowFiles(Predicate)}} can change swap-file 
ordering when only some swap files contain matching FlowFiles.
During selective drop, a partially retained swap file is rewritten. Its 
replacement location is appended to swapLocations. If the rewritten file 
originally preceded an unchanged swap file, the unchanged file is subsequently 
swapped in first, violating FIFO ordering.
Reproduction:


1. Create a queue with a swap threshold of 10 and default FIFO ordering.
2. Enqueue records numbered 0–29:
 - Active queue: 0–9
 - First swap file: 10–19
 - Second swap file: 20–29

3. Selectively drop record 10.

4. Poll the queue.

Expected: Records are returned as 0–9, then 11–29.

Actual: After 0–9, record 20 is returned because the rewritten first swap file 
was moved after the second swap file.

The replacement swap location should retain the original location’s position. 
Add a regression test using multiple swap files that verifies the complete 
polling order after selective drop.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to