You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Jim Brennan (Jira)" <ji...@apache.org> on 2020/11/09 18:12:00 UTC
[jira] [Commented] (HADOOP-17306) RawLocalFileSystem's
lastModifiedTime() loses milli seconds in JDK < 10.b09
[ https://issues.apache.org/jira/browse/HADOOP-17306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17228751#comment-17228751 ]
Jim Brennan commented on HADOOP-17306:
--------------------------------------
From what I can tell, fixing the affected unit tests should be sufficient for this, to make them use the same modification time in the resource as is returned by the RawLocalFileSystem with this change.
I haven't been able to identify any cases in the code where this will introduce new problems, but I can't say for certain it won't. My main concern was whether this change would cause unnecessary re-downloading of localized resources during a rolling upgrade. The {{FSDownload.verifyAndCopy()}} failures in the unit tests are cases where the source FS is a local filesystem, and we are comparing with a pre-set timestamp. I think in the normal case, both the stat and the timestamp will have come from something like HDFS.
I agree that this change will happen in any case when we move to a JDK that changes the underlying behavior.
> RawLocalFileSystem's lastModifiedTime() loses milli seconds in JDK < 10.b09
> ---------------------------------------------------------------------------
>
> Key: HADOOP-17306
> URL: https://issues.apache.org/jira/browse/HADOOP-17306
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs
> Reporter: Vinayakumar B
> Assignee: Vinayakumar B
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> RawLocalFileSystem's FileStatus uses {{File.lastModified()}} api from JDK.
> This api looses milliseconds due to JDK bug.
> [https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8177809]
> This bug fixed in JDK 10 b09 onwards and still exists in JDK 8 which is still being used in many productions.
> Apparently, {{Files.getLastModifiedTime()}} from java's nio package returns correct time.
> Use {{Files.getLastModifiedTime()}} instead of {{File.lastModified}} as workaround.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org