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
(cherry picked from commit 99b120a06e
)
This commit is contained in:
parent
a3f12f7f20
commit
978ce5a1ee
|
@ -1414,7 +1414,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");
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ public class ViewFileSystem extends FileSystem {
|
|||
.append(linkedFallbackFs.getUri());
|
||||
LOG.debug(msg.toString(), e);
|
||||
}
|
||||
return false;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1452,8 +1452,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue