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 st...@apache.org on 2020/08/13 13:32:31 UTC
[hadoop] branch branch-3.3 updated: HDFS-15515: mkdirs on fallback
should throw IOE out instead of suppressing and returning false (#2205)
This is an automated email from the ASF dual-hosted git repository.
stevel pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new 99b120a HDFS-15515: mkdirs on fallback should throw IOE out instead of suppressing and returning false (#2205)
99b120a is described below
commit 99b120a06e27add0b9070c829cd828d41a150e8c
Author: Uma Maheswara Rao G <um...@apache.org>
AuthorDate: Tue Aug 11 00:01:58 2020 -0700
HDFS-15515: mkdirs on fallback should throw IOE out instead of suppressing and returning false (#2205)
* HDFS-15515: mkdirs on fallback should throw IOE out instead of suppressing and returning false
* Used LambdaTestUtils#intercept in test
---
.../src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java | 7 +++----
.../apache/hadoop/fs/viewfs/TestViewFileSystemLinkFallback.java | 5 ++++-
2 files changed, 7 insertions(+), 5 deletions(-)
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 baf0027..ad62f94 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
@@ -1421,7 +1421,7 @@ public class ViewFileSystem extends FileSystem {
@Override
public boolean mkdirs(Path dir, FsPermission permission)
- throws AccessControlException, FileAlreadyExistsException {
+ throws IOException {
if (theInternalDir.isRoot() && dir == null) {
throw new FileAlreadyExistsException("/ already exits");
}
@@ -1451,7 +1451,7 @@ public class ViewFileSystem extends FileSystem {
.append(linkedFallbackFs.getUri());
LOG.debug(msg.toString(), e);
}
- return false;
+ throw e;
}
}
@@ -1459,8 +1459,7 @@ public class ViewFileSystem extends FileSystem {
}
@Override
- public boolean mkdirs(Path dir)
- throws AccessControlException, FileAlreadyExistsException {
+ public boolean mkdirs(Path dir) throws IOException {
return mkdirs(dir, null);
}
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLinkFallback.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLinkFallback.java
index bd2b5af..e731760 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLinkFallback.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLinkFallback.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.fs.viewfs;
+import static org.apache.hadoop.test.LambdaTestUtils.intercept;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -759,7 +760,9 @@ public class TestViewFileSystemLinkFallback extends ViewFileSystemBaseTest {
cluster.shutdownNameNodes(); // Stopping fallback server
// /user1/test1 does not exist in mount internal dir tree, it would
// attempt to create in fallback.
- assertFalse(vfs.mkdirs(nextLevelToInternalDir));
+ intercept(IOException.class, () -> {
+ vfs.mkdirs(nextLevelToInternalDir);
+ });
cluster.restartNameNodes();
// should return true succeed when fallback fs is back to normal.
assertTrue(vfs.mkdirs(nextLevelToInternalDir));
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org