You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by JPercivall <gi...@git.apache.org> on 2017/12/13 23:06:37 UTC

[GitHub] nifi pull request #2337: NIFI-4475 Changing the get(batchSize) method in Sta...

GitHub user JPercivall opened a pull request:

    https://github.com/apache/nifi/pull/2337

    NIFI-4475 Changing the get(batchSize) method in StandardProcessSessio…

    …n so that it checks all connections before returning nothing
    
    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [X] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [X] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [X] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [X] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [X] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [X] Have you written or updated unit tests to verify your changes?
    - [X] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [X] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [X] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [X] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [X] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/JPercivall/nifi NIFI-4475_Making_session_get_x_round_robin_queues

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2337.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2337
    
----
commit 5307d406374c5448d1913a3130459b6724104b10
Author: Joe Percivall <jp...@apache.org>
Date:   2017-12-13T22:17:05Z

    NIFI-4475 Changing the get(batchSize) method in StandardProcessSession so that it checks all connections before returning nothing

----


---

[GitHub] nifi issue #2337: NIFI-4475 Changing the get(batchSize) method in StandardPr...

Posted by markap14 <gi...@git.apache.org>.
Github user markap14 commented on the issue:

    https://github.com/apache/nifi/pull/2337
  
    @JPercivall thanks for jumping in here! I left a couple of comments inline of a few minor tweaks that I'd like to see, but otherwise everything looks good!


---

[GitHub] nifi issue #2337: NIFI-4475 Changing the get(batchSize) method in StandardPr...

Posted by JPercivall <gi...@git.apache.org>.
Github user JPercivall commented on the issue:

    https://github.com/apache/nifi/pull/2337
  
    Thanks for the review @markap14, I pushed out a new commit with those two changes.


---

[GitHub] nifi pull request #2337: NIFI-4475 Changing the get(batchSize) method in Sta...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/2337


---

[GitHub] nifi pull request #2337: NIFI-4475 Changing the get(batchSize) method in Sta...

Posted by markap14 <gi...@git.apache.org>.
Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2337#discussion_r156955954
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java ---
    @@ -1533,13 +1533,11 @@ public FlowFile get() {
                 return Collections.emptyList();
             }
     
    -        final Connection connection = connections.get(context.getNextIncomingConnectionIndex() % connections.size());
    -
    -        return get(connection, new ConnectionPoller() {
    +        return get(new ConnectionPoller() {
                 @Override
                 public List<FlowFileRecord> poll(final Connection connection, final Set<FlowFileRecord> expiredRecords) {
                     return connection.poll(new FlowFileFilter() {
    -                    int polled = 0;
    +                    volatile int polled = 0;
    --- End diff --
    
    We don't need this to be volatile. The variable is not shared between multiple threads and is not operated on atomically (i.e., we use ++polled, which is not atomic for volatile variables).


---

[GitHub] nifi issue #2337: NIFI-4475 Changing the get(batchSize) method in StandardPr...

Posted by JPercivall <gi...@git.apache.org>.
Github user JPercivall commented on the issue:

    https://github.com/apache/nifi/pull/2337
  
    Fantastic thanks @markap14 


---

[GitHub] nifi issue #2337: NIFI-4475 Changing the get(batchSize) method in StandardPr...

Posted by markap14 <gi...@git.apache.org>.
Github user markap14 commented on the issue:

    https://github.com/apache/nifi/pull/2337
  
    Thanks @JPercivall ! Got this merged to master.


---

[GitHub] nifi pull request #2337: NIFI-4475 Changing the get(batchSize) method in Sta...

Posted by markap14 <gi...@git.apache.org>.
Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2337#discussion_r156956891
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java ---
    @@ -1551,7 +1549,7 @@ public FlowFileFilterResult filter(final FlowFile flowFile) {
                         }
                     }, expiredRecords);
                 }
    -        }, false);
    +        }, true);
    --- End diff --
    
    I think in this case we can still get away with 'false'. When the processor passes a Filter in, we lock all queues because we want to ensure that there aren't multiple threads interfering with one another, causing odd filtering (e.g., one thread pulls a given flowfile and then is waiting for another to match but a second thread pulled it). In this particular case though, there is no relationship between the flowfiles being pulled, so we should avoid the expense of locking the queues.


---