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

Jared Stewart commented on GEODE-2649:
--------------------------------------

The root cause appears to be that not all operating systems store the creation 
time of a file. 

In particular, the POSIX standard does not track creation time: 
{code}Each file has three distinct associated timestamps: the time of last data 
access, the time of last data modification, and the time the file status last 
changed.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_09{code}

We relied on the value of a file's creation time in Export Logs to eagerly 
filter out log files that fall outside the time window specified by a user 
(without having to walk through and parse a timestamp from each line).  We also 
used the creation date to determine if a stat file should be filtered out, 
since those files don't have any timestamp to look at inside their contents.  
Here is the Java code we used to get the creation time:
{code}
long creationTimeMillis = 
Files.readAttributes(file,BasicFileAttributes.class).creationTime().toMillis();
{code}

The javadoc for {{java.nio.file.attribute.FileTime creationTime()}} explains 
what is going wrong: 
{code}
Returns the creation time. The creation time is the time that the file was 
created.
If the file system implementation does not support a time stamp to indicate the 
time when the file was created then this method returns an implementation 
specific default value, typically the last-modified-time or a FileTime 
representing the epoch (1970-01-01T00:00:00Z).
{code}

So {{creationTime()}} on Mac OS returns what we expect.  But in CI (on Linux), 
{{creationTime()}} is actually returning the modified time of the log file.

> ExportLogsDUnitTest.testExportWithStartAndEndDateTimeFiltering fails with 
> AssertionError
> ----------------------------------------------------------------------------------------
>
>                 Key: GEODE-2649
>                 URL: https://issues.apache.org/jira/browse/GEODE-2649
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh, tests
>            Reporter: Kirk Lund
>            Assignee: Jared Stewart
>
> {noformat}
> org.apache.geode.management.internal.cli.commands.ExportLogsDUnitTest > 
> testExportWithStartAndEndDateTimeFiltering FAILED
>     java.lang.AssertionError:
>     Expected size:<3> but was:<2> in:
>     <[/tmp/junit8723178147444223944/unzippedLogs/server-1,
>         /tmp/junit8723178147444223944/unzippedLogs/server-2]>
>         at 
> org.apache.geode.management.internal.cli.commands.ExportLogsDUnitTest.verifyZipFileContents(ExportLogsDUnitTest.java:225)
>         at 
> org.apache.geode.management.internal.cli.commands.ExportLogsDUnitTest.testExportWithStartAndEndDateTimeFiltering(ExportLogsDUnitTest.java:155)
> 303 tests completed, 1 failed, 8 skipped
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to