pvillard31 commented on code in PR #11815:
URL: https://github.com/apache/nifi/pull/11815#discussion_r4336156318


##########
nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java:
##########
@@ -1453,9 +1454,9 @@ protected void rollbackRecord(final 
StandardRepositoryRecord record, final boole
                 if (penalize) {
                     final long expirationEpochMillis = 
System.currentTimeMillis() + 
context.getConnectable().getPenalizationPeriod(TimeUnit.MILLISECONDS);
                     final FlowFileRecord newFile = new 
StandardFlowFileRecord.Builder().fromFlowFile(record.getOriginal()).penaltyExpirationTime(expirationEpochMillis).build();
-                    originalQueue.put(newFile);
+                    originalQueue.putToActive(newFile);

Review Comment:
   StatelessFlowTask (lines 397 and 404) also puts polled FlowFiles back with 
put() when the stateless group fails. Should it use putToActive() too, so the 
same reordering does not happen there?



##########
nifi-framework-api/src/main/java/org/apache/nifi/controller/queue/FlowFileQueue.java:
##########
@@ -161,6 +161,16 @@ public interface FlowFileQueue {
      */
     void put(FlowFileRecord file);
 
+    /**
+     * Places the given FlowFile onto the active portion of the queue, never 
onto the swap queue, even if the queue is
+     * currently swapping FlowFiles out. This is intended for FlowFiles that 
were previously polled from this queue and are
+     * being returned to it, such as on session rollback. Because such a 
FlowFile was polled from the active queue, it was
+     * ahead of any FlowFiles that are swapped out, and placing it back onto 
the active queue preserves that ordering.
+     *
+     * @param file the FlowFile to place onto the active queue
+     */

Review Comment:
   Should putToActive have a default implementation that calls put(file), so 
that FlowFileQueue implementations outside this repo keep compiling?



-- 
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]

Reply via email to