wkochman opened a new pull request, #11934: URL: https://github.com/apache/nifi/pull/11934
# Summary [NIFI-16598](https://issues.apache.org/jira/browse/NIFI-16598) When a Processor routes a FlowFile to a retried relationship (for example `failure` with `YIELD_PROCESSOR`), `StandardProcessSession` returns the FlowFile to its original queue during commit using `FlowFileQueue.put()` / `putAll()`. If that queue is swapping, `SwappablePriorityQueue` appends 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 sits behind every remaining active FlowFile, breaking FIFO ordering. Session rollback already avoids this path through `FlowFileQueue.putToActive()` (NIFI-16468). This change applies the same routing to relationship retries: when a FlowFile's destination is the queue it was polled from, commit calls `putToActive()`. Changes: - `FlowFileQueue`: javadoc for `putToActive` now covers rollback and relationship retry. - `StandardProcessSession`: on commit, a FlowFile whose destination equals its original queue is re-added with `putToActive()` instead of being batched into `putAll()`. - `StandardProcessSessionIT`: new `testRetryReturnsFlowFileToFrontOfSwappingQueue` queues 10,001 FlowFiles, retries the first with `YIELD_PROCESSOR`, and asserts the next pull returns FlowFile 0. # Tracking Please complete the following tracking steps prior to pull request creation. ### Issue Tracking - [x] Apache NiFi Jira issue created ### Pull Request Tracking - Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000` - Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000` - Pull request contains commits signed with a registered key indicating `Verified` status ### Pull Request Formatting - Pull Request based on current revision of the `main` branch - Pull Request refers to a feature branch with one commit containing changes # Verification - `StandardProcessSessionIT.testRetryReturnsFlowFileToFrontOfSwappingQueue` covers the retry path with a 10,001-FlowFile swapping queue. - Targeted `StandardProcessSessionIT` tests run locally, including the existing rollback test from NIFI-16468. - `mvn checkstyle:check pmd:check` on `nifi-framework-api`, `nifi-framework-components`, and `nifi-framework-core` reported 0 violations. ### Build - [ ] Build completed using `./mvnw clean install -P contrib-check` - [ ] JDK 21 - [ ] JDK 25 ### Licensing - [x] No new dependencies ### Documentation - [x] Documentation formatting appears as expected in rendered files -- 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]
