Skip to content

Commit

Permalink
HADOOP-16582. LocalFileSystem's mkdirs() does not work as expected un…
Browse files Browse the repository at this point in the history
…der viewfs. Contributed by Kihwal Lee
  • Loading branch information
kihwal committed Sep 19, 2019
1 parent c9900a0 commit d4205dc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ public boolean mkdirs(Path f, FsPermission permission) throws IOException {
return fs.mkdirs(f, permission);
}

@Override
public boolean mkdirs(Path f) throws IOException {
return fs.mkdirs(f);
}

/**
* The src file is on the local disk. Add it to FS at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ public boolean mkdirs(final Path f, final FsPermission permission)
return super.mkdirs(fullPath(f), permission);
}

@Override
public boolean mkdirs(final Path f) throws IOException {
return super.mkdirs(fullPath(f));
}

@Override
public FSDataInputStream open(final Path f, final int bufferSize)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,19 @@ private Path getChrootedPath(InodeTree.ResolveResult<FileSystem> res,
suffix.length() == 0 ? f : new Path(res.resolvedPath, suffix));
}

@Override
public boolean mkdirs(Path dir) throws IOException {
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(dir), false);
return res.targetFileSystem.mkdirs(res.remainingPath);
}

@Override
public boolean mkdirs(final Path dir, final FsPermission permission)
throws IOException {
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(dir), false);
return res.targetFileSystem.mkdirs(res.remainingPath, permission);
fsState.resolve(getUriPath(dir), false);
return res.targetFileSystem.mkdirs(res.remainingPath, permission);
}

@Override
Expand Down Expand Up @@ -1171,6 +1178,12 @@ public boolean mkdirs(Path dir, FsPermission permission)
throw readOnlyMountTable("mkdirs", dir);
}

@Override
public boolean mkdirs(Path dir)
throws AccessControlException, FileAlreadyExistsException {
return mkdirs(dir, null);
}

@Override
public FSDataInputStream open(Path f, int bufferSize)
throws AccessControlException, FileNotFoundException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
boolean overwrite, int bufferSize, short replication, long blockSize,
Progressable progress) throws IOException;

public boolean mkdirs(Path f);
public FSDataInputStream open(Path f);
public FSDataInputStream open(PathHandle f);
public FSDataOutputStream create(Path f);
Expand Down

0 comments on commit d4205dc

Please sign in to comment.