[
https://issues.apache.org/jira/browse/HADOOP-9438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13643075#comment-13643075
]
Omkar Vinit Joshi commented on HADOOP-9438:
-------------------------------------------
[~rémy] I see few problems with current implementation.
* Why is the check added to FileSystem?? This is good if we check it upfront
but better it will be to delegate the call to RawLocalFileSystem or any other
file system and check the return or exception type. At present there exists a
race condition. This code will work if we receive mkdir requests one after the
other but will not work if they arrive at the same time. Did you take a look at
the below method? I suspect that fixing this will solve the whole problem. What
do you think?
This method will either create the directory or will silently return if the
directory is already present.
{code:title=RawLocalFileSystem.java|borderStyle=solid}
public boolean mkdirs(Path f) throws IOException {
....
return (parent == null || mkdirs(parent)) &&
(p2f.mkdir() || p2f.isDirectory());
....
}
{code}
* All the Test code classes are created with different name formats. for unit
test Please create classes "Test...." and methods as "test...."
> 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.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