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

Robert Joseph Evans commented on HADOOP-9438:
---------------------------------------------

Like I said initially I am fine with having the javadocs and interface for 
FileContext.mkdir changed.  The problem isn't that FileContext does not throw 
the exception the problem is that it is inconsistent with the documented 
interface. This resulted in incorrect code being written in YARN. The above 
code is not going to solve the problem because there is a race.  If fs.exists 
returns false and then the file is created the mkdir will become a noop and the 
interface still is not followed.

Changing the FileSystem definition to throw an exception on a mkdir is not 
acceptable either.  This will not just break tests it will break lots of 
downstream customers.  

The trick with changing the FileContext definition is that we have to be sure 
that it is in line with the other implementations as well.  If all of the 
FileContext implementations are wrappers around FileSystem implementations then 
it should not be a problem to change this.
                
> LocalFileContext does not throw an exception on mkdir for already existing 
> directory
> ------------------------------------------------------------------------------------
>
>                 Key: HADOOP-9438
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9438
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.0.3-alpha
>            Reporter: Robert Joseph Evans
>            Priority: Critical
>         Attachments: HADOOP-9438.20130501.1.patch, HADOOP-9438.patch, 
> HADOOP-9438.patch
>
>
> according to 
> http://hadoop.apache.org/docs/current/api/org/apache/hadoop/fs/FileContext.html#mkdir%28org.apache.hadoop.fs.Path,%20org.apache.hadoop.fs.permission.FsPermission,%20boolean%29
> should throw a FileAlreadyExistsException if the directory already exists.
> I tested this and 
> {code}
> FileContext lfc = FileContext.getLocalFSFileContext(new Configuration());
> Path p = new Path("/tmp/bobby.12345");
> FsPermission cachePerms = new FsPermission((short) 0755);
> lfc.mkdir(p, cachePerms, false);
> lfc.mkdir(p, cachePerms, false);
> {code}
> never throws an exception.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to