You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ki...@apache.org on 2019/09/19 13:24:10 UTC
[hadoop] branch trunk updated: HADOOP-16582. LocalFileSystem's
mkdirs() does not work as expected under viewfs. Contributed by Kihwal Lee
This is an automated email from the ASF dual-hosted git repository.
kihwal pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new d4205dc HADOOP-16582. LocalFileSystem's mkdirs() does not work as expected under viewfs. Contributed by Kihwal Lee
d4205dc is described below
commit d4205dce176287e863f567b333e0d408bf51ae6d
Author: Kihwal Lee <ki...@apache.org>
AuthorDate: Thu Sep 19 08:22:19 2019 -0500
HADOOP-16582. LocalFileSystem's mkdirs() does not work as expected under viewfs. Contributed by Kihwal Lee
---
.../java/org/apache/hadoop/fs/FilterFileSystem.java | 4 ++++
.../org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java | 5 +++++
.../org/apache/hadoop/fs/viewfs/ViewFileSystem.java | 17 +++++++++++++++--
.../java/org/apache/hadoop/fs/TestFilterFileSystem.java | 1 -
4 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
index 99c18b6..e05c574 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
@@ -334,6 +334,10 @@ public class FilterFileSystem extends FileSystem {
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
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
index cec1891..c93225f 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
@@ -280,6 +280,11 @@ class ChRootedFileSystem extends FilterFileSystem {
}
@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 {
return super.open(fullPath(f), bufferSize);
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
index f127d8d..6bc469c 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
@@ -550,11 +550,18 @@ public class ViewFileSystem extends FileSystem {
}
@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
@@ -1172,6 +1179,12 @@ public class ViewFileSystem extends FileSystem {
}
@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 {
checkPathIsSlash(f);
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java
index 6de4f07..f0057a6 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java
@@ -77,7 +77,6 @@ public class TestFilterFileSystem {
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);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org