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

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

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

    https://github.com/apache/nifi/pull/1966#discussion_r125488638
  
    --- Diff: 
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java
 ---
    @@ -171,18 +211,29 @@ public void onPropertyModified(final 
PropertyDescriptor descriptor, final String
          * Determines which of the given FileStatus's describes a File that 
should be listed.
          *
          * @param statuses the eligible FileStatus objects that we could 
potentially list
    +     * @param context processor context with properties values
          * @return a Set containing only those FileStatus objects that we want 
to list
          */
    -    Set<FileStatus> determineListable(final Set<FileStatus> statuses) {
    +    Set<FileStatus> determineListable(final Set<FileStatus> statuses, 
ProcessContext context) {
             final long minTimestamp = this.latestTimestampListed;
             final TreeMap<Long, List<FileStatus>> orderedEntries = new 
TreeMap<>();
     
    +        final Long minAgeProp = 
context.getProperty(MIN_AGE).asTimePeriod(TimeUnit.MILLISECONDS);
    +        final long minimumAge = (minAgeProp == null) ? 0L : minAgeProp;
    +        final Long maxAgeProp = 
context.getProperty(MAX_AGE).asTimePeriod(TimeUnit.MILLISECONDS);
    +        final long maximumAge = (maxAgeProp == null) ? Long.MAX_VALUE : 
maxAgeProp;
    +
             // Build a sorted map to determine the latest possible entries
             for (final FileStatus status : statuses) {
                 if (status.getPath().getName().endsWith("_COPYING_")) {
                     continue;
                 }
     
    +            final long fileAge = System.currentTimeMillis() - 
status.getModificationTime();
    --- End diff --
    
    as implemented, this could change the behavior of this processor. If the 
file modification time is in the future relative to the nifi instance (in 
reading through the hadoop code, it looks like this can happen), this would 
skip that file if minAgeProp was not set.


> Add minimum/maximum file age properties to ListHDFS
> ---------------------------------------------------
>
>                 Key: NIFI-4144
>                 URL: https://issues.apache.org/jira/browse/NIFI-4144
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Pierre Villard
>            Assignee: Pierre Villard
>            Priority: Minor
>
> In some situations it would be interesting to have the minimum/maximum file 
> age properties in ListHDFS as we have in GetHDFS.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to