HADOOP-12172. FsShell mkdir -p makes an unnecessary check for the existence of the parent. Contributed by Chris Nauroth.

(cherry picked from commit f3796224bf)
This commit is contained in:
cnauroth 2015-07-01 19:47:58 -07:00
parent 490bef0856
commit 0d94a293a8
2 changed files with 5 additions and 1 deletions

View File

@ -201,6 +201,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-12112. Make hadoop-common-project Native code -Wall-clean HADOOP-12112. Make hadoop-common-project Native code -Wall-clean
(alanburlison via cmccabe) (alanburlison via cmccabe)
HADOOP-12172. FsShell mkdir -p makes an unnecessary check for the existence
of the parent. (cnauroth)
BUG FIXES BUG FIXES
HADOOP-11802: DomainSocketWatcher thread terminates sometimes after there HADOOP-11802: DomainSocketWatcher thread terminates sometimes after there

View File

@ -70,7 +70,8 @@ class Mkdir extends FsCommand {
protected void processNonexistentPath(PathData item) throws IOException { protected void processNonexistentPath(PathData item) throws IOException {
// check if parent exists. this is complicated because getParent(a/b/c/) returns a/b/c, but // check if parent exists. this is complicated because getParent(a/b/c/) returns a/b/c, but
// we want a/b // we want a/b
if (!item.fs.exists(new Path(item.path.toString()).getParent()) && !createParents) { if (!createParents &&
!item.fs.exists(new Path(item.path.toString()).getParent())) {
throw new PathNotFoundException(item.toString()); throw new PathNotFoundException(item.toString());
} }
if (!item.fs.mkdirs(item.path)) { if (!item.fs.mkdirs(item.path)) {