[
https://issues.apache.org/jira/browse/NIFI-2383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429461#comment-15429461
]
Joe Skora commented on NIFI-2383:
---------------------------------
This could be hard to do in a cross-platform manner. Even where the OS
supports it, the JVM (1.8.0_77) does not consistently return creation times so
the modification time is the only reliable cross platform file timestamp.
That said, I could see a scenario where the modification and creation
timestamps could be combined to determine the watermark, but it still won't be
trivial to determine priority as well as what happens when the creation date
moves and the modification date doesn't. In the ticket description, a file is
placed back in the source directory with the original modification timestamp
and a new creation timestamp, but what if the creation timestamp gets older, or
if both timestamps change? Even if the creation date was reliably available,
the behavior could be very difficult to articulate and implement clearly let
alone test and document.
As an example, my development system uses Ext4. The os {{stat}} command shows
distinct create (change), modification, and access timestamps:
{code}
$ stat test1.dat
File: ‘test1.dat’
Size: 1040 Blocks: 24 IO Block: 4096 regular file
Device: 2eh/46d Inode: 11540205 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ jskora) Gid: ( 1000/ jskora)
Access: 2016-08-19 21:11:35.275008908 -0400
Modify: 2016-08-19 21:11:34.651019201 -0400
Change: 2016-08-20 13:30:14.254345026 -0400
Birth: -
{code}
However, a simple [Scala
script|https://gist.github.com/jskora/1fec55b837954df5711c5c00a573235d] that
uses both the Java NIO File BasicFileAttributeView and PosixFileAttributeView
to pull the timestamps loses both the create (change) value and the millisecond
details.
{code}
$ scala stat.scala test1.dat
test1.dat
basic creation= 2016-08-19T21:11:34.000 -0400
basic access = 2016-08-19T21:11:35.000 -0400
basic modified= 2016-08-19T21:11:34.000 -0400
posix creation= 2016-08-19T21:11:34.000 -0400
posix access = 2016-08-19T21:11:35.000 -0400
posix modified= 2016-08-19T21:11:34.000 -
{code}
> ListFile does not detect new files
> ----------------------------------
>
> Key: NIFI-2383
> URL: https://issues.apache.org/jira/browse/NIFI-2383
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Reporter: n h
> Labels: ListFile
> Fix For: 0.7.1
>
>
> ListFile does not detect directory updates correctly. It seems it only check
> for file name and modified date.
> Using a 2 processors flow: ListFile -> FetchFile, and configure FetchFile to
> finally delete files. Following scenario fails:
> 1. Create file1.txt somewhere outside of watching directory.
> 2. Copy file1.txt to watching directory.
> 3. Wait for FetchFile to fetch and delete file1.txt
> 4. Copy file1.txt again to watching directory.
> In the 2nd time ListFile does not detect "new copy of the same file
> file1.txt" because file name and modified time are the same. Only creation
> time is updated.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)