Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-5000

ListHDFS doesn't list files from updated 'directory'

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0, 1.3.0, 1.4.0, 1.5.0
    • Fix Version/s: None
    • Component/s: Extensions
    • Labels:
      None
    • Flags:
      Important

      Description

      ListHDFS lists files and saves the latest listed files' modified time - latestTimestampListed and latestTimestampEmitted in the `StateMap`. It is overriding `onPropertyModified` to check if the `Directory` or the `File Filter` has been modified and if they are indeed modified, it will reset the statemap variables to `-1L` so as to list all the files from the updated `Directory` or according to the updated `File Filter`. However it is not working as intended.

      Scenario:

      1. Create two directories in HDFS
        1. > hdfs dfs -mkdir /test1
        2. > hdfs dfs -mkdir /test2
      2. Write files to the above directories in the following order:
        1. > hdfs dfs -put sample.txt /test1/t1_1.txt
        2. > hdfs dfs -put sample.txt /test2/t2_1.txt
        3. > hdfs dfs -put sample.txt /test1/t1_2.txt
      3. Configure ListHDFS and set Directory to /test1 and start the processor. It will produce two flowfiles: t1_1.txt and t1_2.txt
      4. Stop the processor. Configure and set Directory to /test2. Ideally the state variables (listed and emitted timestamp) should be reset and they should list the file t2_1.txt but it is not.
      5. Now put one more file to test2:
        1. > hdfs dfs -put sample.txt /test2/2_2.txt
      6. This would have listed the file t2_2.txt. File t2_1.txt is missed

      Little debugging helped me found that the `onPropertyModified` indeed works as intended but somewhere else the code still reads the last saved state i.e. the modified time of /test1/t1_2.txt

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sivaprasanna Sivaprasanna Sethuraman
                Reporter:
                sivaprasanna Sivaprasanna Sethuraman
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: