Mark Payne created NIFI-16468:
---------------------------------
Summary: Session rollback can put FlowFile back on swap queue,
changing queue order
Key: NIFI-16468
URL: https://issues.apache.org/jira/browse/NIFI-16468
Project: Apache NiFi
Issue Type: Bug
Components: Core Framework
Reporter: Mark Payne
Assignee: Mark Payne
When a Processor pulls a FlowFile from a queue and then rolls back the session,
the FlowFile is returned to its original queue using {{FlowFileQueue.put()}}.
If that queue is in swap mode at the time, {{SwappablePriorityQueue}} adds the
FlowFile to the swap queue instead of the active queue. The FlowFile was at the
front of the active queue when it was polled, so it now ends up behind every
other FlowFile in the active queue. This breaks ordering for any prioritizer,
most noticeably the First In First Out prioritizer.
This can be reproduced with a queue whose swap threshold is 10,000. Queue
10,001 FlowFiles, pull the first one, and roll back the session. The next pull
returns the second FlowFile instead of the first.
To address this, add {{void putToActive(FlowFileRecord)}} to {{FlowFileQueue}}
and pass it through the queue partitions down to {{SwappablePriorityQueue}},
where it always adds to the active queue. Then use it from
{{StandardProcessSession}} when rolling back.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)