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

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

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

    https://github.com/apache/nifi/pull/1181#discussion_r86528178
  
    --- Diff: 
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
 ---
    @@ -315,21 +328,24 @@ public void process(InputStream in) throws 
IOException {
                 final long millis = 
stopWatch.getDuration(TimeUnit.MILLISECONDS);
                 tempDotCopyFile = tempCopyFile;
     
    -            boolean renamed = false;
    -            for (int i = 0; i < 10; i++) { // try to rename multiple times.
    -                if (hdfs.rename(tempCopyFile, copyFile)) {
    -                    renamed = true;
    -                    break;// rename was successful
    +            if(!conflictResponse.equals(APPEND_RESOLUTION.getValue())
    +                    || 
(conflictResponse.equals(APPEND_RESOLUTION.getValue()) && !destinationExists)) {
    +                boolean renamed = false;
    +                for (int i = 0; i < 10; i++) { // try to rename multiple 
times.
    +                    if (hdfs.rename(tempCopyFile, copyFile)) {
    +                        renamed = true;
    +                        break;// rename was successful
    +                    }
    +                    Thread.sleep(200L);// try waiting to let whatever 
might cause rename failure to resolve
    --- End diff --
    
    To be honest, no I don't. I assume that there is some kind of asynchronous 
call we are doing before when talking to remote clusters and that we might need 
to make this try multiple times to actually succeed. Not sure if it is still 
required with the last versions of HDFS client but didn't want to change it.


> Support appending files in PutHDFS
> ----------------------------------
>
>                 Key: NIFI-1322
>                 URL: https://issues.apache.org/jira/browse/NIFI-1322
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Scott
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to