You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by zenfenan <gi...@git.apache.org> on 2018/05/06 04:18:40 UTC

[GitHub] nifi pull request #2681: NIFI-5152: MoveHDFS now works even with no upstream...

GitHub user zenfenan opened a pull request:

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

    NIFI-5152: MoveHDFS now works even with no upstream connection

    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?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] 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)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] 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/zenfenan/nifi NIFI-5152

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

    https://github.com/apache/nifi/pull/2681.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 #2681
    
----
commit 0bebece97204edabffe1273afbd114d63e883209
Author: zenfenan <si...@...>
Date:   2018-05-06T04:16:19Z

    NIFI-5152: MoveHDFS now works even with no upstream connection

----


---

[GitHub] nifi pull request #2681: NIFI-5152: MoveHDFS now works even with no upstream...

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

    https://github.com/apache/nifi/pull/2681#discussion_r186457698
  
    --- Diff: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java ---
    @@ -228,14 +232,15 @@ public void onScheduled(ProcessContext context) throws Exception {
     
         @Override
         public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
    -        // MoveHDFS
    -        FlowFile parentFlowFile = session.get();
    -        if (parentFlowFile == null) {
    -            return;
    +        FlowFile flowFile = null;
    +
    +        if (context.hasIncomingConnection()) {
    +            flowFile = session.get();
    --- End diff --
    
    If we have an incoming relationship and we call session.get() and get back a null flow file, then I think we want to return. We only want to create a new flow file if there is no incoming relationship.


---

[GitHub] nifi pull request #2681: NIFI-5152: MoveHDFS now works even with no upstream...

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

    https://github.com/apache/nifi/pull/2681#discussion_r186464753
  
    --- Diff: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java ---
    @@ -228,14 +232,15 @@ public void onScheduled(ProcessContext context) throws Exception {
     
         @Override
         public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
    -        // MoveHDFS
    -        FlowFile parentFlowFile = session.get();
    -        if (parentFlowFile == null) {
    -            return;
    +        FlowFile flowFile = null;
    +
    +        if (context.hasIncomingConnection()) {
    +            flowFile = session.get();
    --- End diff --
    
    Done


---

[GitHub] nifi pull request #2681: NIFI-5152: MoveHDFS now works even with no upstream...

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

    https://github.com/apache/nifi/pull/2681#discussion_r186485684
  
    --- Diff: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java ---
    @@ -228,14 +232,17 @@ public void onScheduled(ProcessContext context) throws Exception {
     
         @Override
         public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
    -        // MoveHDFS
    -        FlowFile parentFlowFile = session.get();
    -        if (parentFlowFile == null) {
    +        FlowFile flowFile = session.get();
    +
    +        if (flowFile == null && context.hasIncomingConnection()) {
    +            context.yield();
    --- End diff --
    
    Thanks for pointing it out. I understand now. 


---

[GitHub] nifi issue #2681: NIFI-5152: MoveHDFS now works even with no upstream connec...

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

    https://github.com/apache/nifi/pull/2681
  
    Merged to master, thanks!


---

[GitHub] nifi pull request #2681: NIFI-5152: MoveHDFS now works even with no upstream...

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

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


---

[GitHub] nifi pull request #2681: NIFI-5152: MoveHDFS now works even with no upstream...

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

    https://github.com/apache/nifi/pull/2681#discussion_r186478219
  
    --- Diff: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java ---
    @@ -228,14 +232,17 @@ public void onScheduled(ProcessContext context) throws Exception {
     
         @Override
         public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
    -        // MoveHDFS
    -        FlowFile parentFlowFile = session.get();
    -        if (parentFlowFile == null) {
    +        FlowFile flowFile = session.get();
    +
    +        if (flowFile == null && context.hasIncomingConnection()) {
    +            context.yield();
    --- End diff --
    
    I know this is a minor point, but we don't need to yield here. Unless a processor has @TriggerWhenEmpty then it won't be scheduled unless there are flow files in the queue so we don't have to work about repeatedly executing and getting null. The case we can get null is when concurrent tasks is > 1 and one tasks grabs the flow file and the other gets null.


---