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

Steve Loughran commented on HADOOP-12258:
-----------------------------------------

This is a major regression —it's good you caught it.

The requirement that getStatus on a nonexistent path throws an FNFE should be 
part of the fs contract tests -it should have been caught there.

Similarly, we need a test which checks the requirement path.setTimes(time) 
throws an FNFE if the path doesn't exist.

Do you fancy adding a new Abstract FS Contract test for set times, so that we 
can do it consistently across a filesystems? The same tests could be used (we 
could add an FS granularity option too to the test contract, so that 
filesystems could declare tighter vs looser times (I think FAT32 is 2s, for 
example)

> Need translate java.nio.file.NoSuchFileException to FileNotFoundException in 
> DeprecatedRawLocalFileStatus constructor
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-12258
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12258
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>            Reporter: zhihai xu
>            Assignee: zhihai xu
>            Priority: Critical
>         Attachments: HADOOP-12258.000.patch
>
>
> need translate java.nio.file.NoSuchFileException to FileNotFoundException in 
> DeprecatedRawLocalFileStatus constructor. 
> HADOOP-12045 adds nio to support access time, but nio will create 
> java.nio.file.NoSuchFileException instead of FileNotFoundException.
> many hadoop codes depend on FileNotFoundException to decide whether a file 
> exists. for example {{FileContext.util().exists()}}. 
> {code}
>     public boolean exists(final Path f) throws AccessControlException,
>       UnsupportedFileSystemException, IOException {
>       try {
>         FileStatus fs = FileContext.this.getFileStatus(f);
>         assert fs != null;
>         return true;
>       } catch (FileNotFoundException e) {
>         return false;
>       }
>     }
> {code}
> same for {{FileSystem#exists}}
> {code}
>   public boolean exists(Path f) throws IOException {
>     try {
>       return getFileStatus(f) != null;
>     } catch (FileNotFoundException e) {
>       return false;
>     }
>   }
> {code}
> NoSuchFileException will break these functions.
> Since {{exists}} is one of the most used API in FileSystem, this issue is 
> very critical.
> Several test failures for TestDeletionService are caused by this issue:
> https://builds.apache.org/job/PreCommit-YARN-Build/8630/testReport/org.apache.hadoop.yarn.server.nodemanager/TestDeletionService/testRelativeDelete/
> https://builds.apache.org/job/PreCommit-YARN-Build/8632/testReport/org.apache.hadoop.yarn.server.nodemanager/TestDeletionService/testAbsDelete/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to