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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---