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

Andras Bokor commented on HDFS-303:
-----------------------------------

bq. When trying to make a directory under an existing file, HDFS throws an 
IOException while LocalFileSystem doesn't.
HADOOP-6229 solves this
bq. The FileSytem#listStatus(Path) method returns null for a non-existent file 
on HDFS, while LocalFileSytem returns an empty FileStatus array.
In HADOOP-6201 and HDFS-538 it was agreed that FileSystem::listStatus should 
throw FileNotFoundException instead of returning null, when the target 
directory does not exist.
In addition in {{DistributedFilesystem}}:
{code:title=DistributedFilesystem.java:862}
if (thisListing == null) { // the directory does not exist
    throw new FileNotFoundException("File " + p + " does not exist.");
}
{code}
In {{RawLocalFileSystem}}:
{code}
if (!localf.exists()) {
    throw new FileNotFoundException("File " + f + " does not exist");
}
{code}
So it seems HDFS throws exception too.
bq. When trying to rename a non-existent path, LocalFileSystem throws an 
IOException, while HDFS returns false.
HDFS-6262. I wrote a comment that I think that ticket should be closed as 
"Won't fix".
bq. When renaming a file or directory to a non-existent directory (e.g. /a/b to 
/c/d, where /c doesn't exist) LocalFileSystem succeeds (returns true) while 
HDFS fails (false).
I think it is the same as was discussed in HADOOP-13082
bq. When renaming a file (or directory) as an existing file (or directory) 
LocalFileSystem succeeds (returns true) while HDFS fails (false).
The discussion in HADOOP-13082 covers this as well.
Based on this I think the ticket can be closed. Do you have any objection?

> Make contracts of LocalFileSystem and DistributedFileSystem consistent
> ----------------------------------------------------------------------
>
>                 Key: HDFS-303
>                 URL: https://issues.apache.org/jira/browse/HDFS-303
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Tom White
>            Assignee: Andras Bokor
>         Attachments: HDFS-303-common-test-case.patch, HDFS-303.patch, 
> hadoop-4114.patch
>
>
> There are a number of edge cases that the two file system implementations 
> handle differently. In particular:
> * When trying to make a directory under an existing file, HDFS throws an 
> IOException while LocalFileSystem doesn't.
> * The FileSytem#listStatus(Path) method returns null for a non-existent file 
> on HDFS, while LocalFileSytem returns an empty FileStatus array.
> * When trying to rename a non-existent path, LocalFileSystem throws an 
> IOException, while HDFS returns false.
> * When renaming a file or directory to a non-existent directory (e.g. /a/b to 
> /c/d, where /c doesn't exist) LocalFileSystem succeeds (returns true) while 
> HDFS fails (false).
> * When renaming a file (or directory) as an existing file (or directory) 
> LocalFileSystem succeeds (returns true) while HDFS fails (false).
> We should document the expected behaviour for these cases in FileSystem's 
> javadoc, and make sure all implementations conform to it.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to