[ 
https://issues.apache.org/jira/browse/NIFI-5514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16624850#comment-16624850
 ] 

ASF GitHub Bot commented on NIFI-5514:
--------------------------------------

Github user bdesert commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2954#discussion_r219683471
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeRecord.java
 ---
    @@ -304,13 +336,25 @@ public void onTrigger(final ProcessContext context, 
final ProcessSessionFactory
                 session.commit();
             }
     
    +        // If there is no more data queued up, complete any bin that meets 
our minimum threshold
    +        int completedBins = 0;
    +        final QueueSize queueSize = session.getQueueSize();
    --- End diff --
    
    @markap14 
    Test for MinRecords is successful, but actual flow doesn't work as expected 
and still doesn't respect Min Records setting.
    There is my set up:
    
![image](https://user-images.githubusercontent.com/19496093/45922181-efa6f880-be92-11e8-92b1-4f6daf756463.png)
    
    
![image](https://user-images.githubusercontent.com/19496093/45922183-02b9c880-be93-11e8-9565-fe8ef8908245.png)
    
    The problem is in different behavior of MockProcessSession and 
StandardProcessSession.
    MockProcessSession.getQueueSize() will return 0, after session.get(...)
    StandardProcessSession.getQueueSize() will return same number as before 
session.get(...), regardless flow files have been polled or not.
    As a result, this condition will block from actually emitting FF when min 
requirements are reached.
    
    I would recommend to change this condition to:
    if (flowFiles.size() != 0) {...}
    
    In parallel, we probably need to open a JIRA for inconsistency between 
MockProcessSession and StandardProcessSession.



> MergeRecord does not create a merged FlowFile until a maximum threshold is 
> reached
> ----------------------------------------------------------------------------------
>
>                 Key: NIFI-5514
>                 URL: https://issues.apache.org/jira/browse/NIFI-5514
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>            Priority: Major
>             Fix For: 1.8.0
>
>
> MergeRecord allows the user to specify a minimum number of records. However, 
> if the minimum number of records is reached, the merged FlowFile is not 
> created unless the maximum number of records or max number of bytes is also 
> reached.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to