[
https://issues.apache.org/jira/browse/HDFS-4839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13662583#comment-13662583
]
Colin Patrick McCabe commented on HDFS-4839:
--------------------------------------------
The Java designers are well aware of the deficiencies of the current API, and
have added a new API in Java 7 called {{Files#createDirectory}}. This API
throws an appropriate {{IOException}} on failure, rather than just returning
false.
You can check it out here:
http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createDirectory(java.nio.file.Path,
java.nio.file.attribute.FileAttribute...)
So it's not a "tradeoff" they made, it's a mistake they made, which they are
now correcting. It's not difficult to give relevant error messages on all
platforms, including Windows and all the UNIXes. Unfortunately, the JDK7 APIs
will not be available to us for many years, since we are going to be supporting
JDK6 for quite some time.
bq. I saw that we already introduced rename for similar reasons. My initial
thought when I saw a Jira to implement the same functionality on Windows was,
why not just remove the native implementation altogether
I have had to diagnose issues in production clusters where rename or mkdir
failed, and the logs did not reveal why. It's not fun. And it can lead to
very serious code and/or system administration problems getting misdiagnosed.
It's also another reason we have so many flaky unit tests that never get fixed.
So I think you should reconsider.
> add NativeIO#mkdirs, that provides an error message on failure
> --------------------------------------------------------------
>
> Key: HDFS-4839
> URL: https://issues.apache.org/jira/browse/HDFS-4839
> Project: Hadoop HDFS
> Issue Type: Improvement
> Affects Versions: 2.0.5-beta
> Reporter: Colin Patrick McCabe
> Priority: Minor
>
> It would be nice to have a variant of mkdirs that provided an error message
> explaining why it failed. This would make it easier to debug certain failing
> unit tests that rely on mkdir / mkdirs-- the ChecksumFilesystem tests, for
> example.
--
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