From 2a610f99efe628bfa73230ed704bb28ddf857d79 Mon Sep 17 00:00:00 2001 From: Abhishek Das Date: Wed, 13 May 2020 14:48:53 -0700 Subject: [PATCH 1/6] HADOOP-17024. ListStatus on ViewFS root should list the linkFallBack root --- .../apache/hadoop/fs/viewfs/InodeTree.java | 13 +++ .../hadoop/fs/viewfs/ViewFileSystem.java | 35 +++++++- .../TestViewFileSystemLinkFallback.java | 81 +++++++++++++++++++ 3 files changed, 128 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java index 69923438ecc20..b3b2d663f2556 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java @@ -123,6 +123,7 @@ static class INodeDir extends INode { private final Map> children = new HashMap<>(); private T internalDirFs = null; //filesystem of this internal directory private boolean isRoot = false; + private INodeLink fallbackLink = null; INodeDir(final String pathToNode, final UserGroupInformation aUgi) { super(pathToNode, aUgi); @@ -149,6 +150,17 @@ boolean isRoot() { return isRoot; } + INodeLink getFallbackLink() { + return fallbackLink; + } + + void addFallbackLink(INodeLink fallbackLink) throws IOException { + if (!isRoot) { + throw new IOException("fallbackLink can only be set for root"); + } + this.fallbackLink = fallbackLink; + } + Map> getChildren() { return Collections.unmodifiableMap(children); } @@ -580,6 +592,7 @@ protected InodeTree(final Configuration config, final String viewName) } } rootFallbackLink = fallbackLink; + getRootDir().addFallbackLink(rootFallbackLink); } if (!gotMountTableEntry) { 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 115fc033f2702..a6523eea37ee9 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 @@ -1204,6 +1204,7 @@ public FileStatus getFileStatus(Path f) throws IOException { public FileStatus[] listStatus(Path f) throws AccessControlException, FileNotFoundException, IOException { checkPathIsSlash(f); + FileStatus[] fallbackStatuses = listStatusForFallbackLink(); FileStatus[] result = new FileStatus[theInternalDir.getChildren().size()]; int i = 0; for (Entry> iEntry : @@ -1226,7 +1227,39 @@ public FileStatus[] listStatus(Path f) throws AccessControlException, myUri, null)); } } - return result; + if (fallbackStatuses.length > 0) { + return consolidateFileStatuses(fallbackStatuses, result); + } else { + return result; + } + } + + private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, + FileStatus[] mountPointStatuses) { + ArrayList result = new ArrayList<>(); + Set pathSet = new HashSet<>(); + int i = 0; + for (FileStatus status : mountPointStatuses) { + result.add(status); + pathSet.add(status.getPath().getName()); + } + for (FileStatus status : fallbackStatuses) { + if (!pathSet.contains(status.getPath().getName())) { + result.add(status); + } + } + return result.toArray(new FileStatus[0]); + } + + private FileStatus[] listStatusForFallbackLink() throws IOException { + if (theInternalDir.isRoot() && theInternalDir.getFallbackLink() != null) { + URI fallBackUri = theInternalDir.getFallbackLink().targetDirLinkList[0]; + ChRootedFileSystem linkedFs = (ChRootedFileSystem) + theInternalDir.getFallbackLink().getTargetFileSystem(); + return linkedFs.getMyFs().listStatus(new Path(fallBackUri.toString())); + } else { + return new FileStatus[0]; + } } @Override 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 5fb7c3b07f41f..6914f1d1dc42a 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 @@ -26,6 +26,7 @@ import java.net.URI; import java.net.URISyntaxException; +import java.util.HashSet; import javax.security.auth.login.LoginException; import org.apache.hadoop.conf.Configuration; @@ -261,4 +262,84 @@ public void testConfLinkFallbackWithMountPoint() throws Exception { e.getMessage().contains(expectedErrorMsg)); } } + + /** + * This tests whether the fallback link gets listed for list operation + * of root directory of mount table + * @throws Exception + */ + @Test + public void testListingWithFallbackLink() throws Exception { + Path dir1 = new Path(targetTestRoot, "fallbackDir/dir1"); + fsTarget.mkdirs(dir1); + String clusterName = Constants.CONFIG_VIEWFS_DEFAULT_MOUNT_TABLE; + URI viewFsUri = new URI(FsConstants.VIEWFS_SCHEME, clusterName, + "/", null, null); + + HashSet beforeFallback = new HashSet<>(); + try(FileSystem vfs = FileSystem.get(viewFsUri, conf)) { + for (FileStatus stat : vfs.listStatus(new Path(viewFsUri.toString()))) { + beforeFallback.add(stat.getPath()); + } + } + + ConfigUtil.addLinkFallback(conf, clusterName, + new Path(targetTestRoot, "fallbackDir").toUri()); + + try (FileSystem vfs = FileSystem.get(viewFsUri, conf)) { + HashSet afterFallback = new HashSet<>(); + for (FileStatus stat : vfs.listStatus(new Path(viewFsUri.toString()))) { + afterFallback.add(stat.getPath()); + } + afterFallback.removeAll(beforeFallback); + assertTrue("Listing didn't include fallback link", + afterFallback.size() == 1); + Path[] fallbackArray = new Path[afterFallback.size()]; + assertEquals("Path did not match" , + dir1, afterFallback.toArray(fallbackArray)[0]); + } + } + + /** + * This tests whether fallback directory gets shaded during list operation + * of root directory of mount table when the same directory name exists as + * mount point as well as in the fallback linked directory + * @throws Exception + */ + @Test + public void testListingWithFallbackLinkWithSameMountDirectories() + throws Exception { + // Creating two directories under the fallback directory. + // "user" directory already exists as configured mount point. + Path dir1 = new Path(targetTestRoot, "fallbackDir/user"); + Path dir2 = new Path(targetTestRoot, "fallbackDir/user1"); + fsTarget.mkdirs(dir1); + fsTarget.mkdirs(dir2); + String clusterName = Constants.CONFIG_VIEWFS_DEFAULT_MOUNT_TABLE; + URI viewFsUri = new URI(FsConstants.VIEWFS_SCHEME, clusterName, + "/", null, null); + + HashSet beforeFallback = new HashSet<>(); + try(FileSystem vfs = FileSystem.get(viewFsUri, conf)) { + for (FileStatus stat : vfs.listStatus(new Path(viewFsUri.toString()))) { + beforeFallback.add(stat.getPath()); + } + } + ConfigUtil.addLinkFallback(conf, clusterName, + new Path(targetTestRoot, "fallbackDir").toUri()); + + try (FileSystem vfs = FileSystem.get(viewFsUri, conf)) { + HashSet afterFallback = new HashSet<>(); + for (FileStatus stat : vfs.listStatus(new Path(viewFsUri.toString()))) { + afterFallback.add(stat.getPath()); + } + afterFallback.removeAll(beforeFallback); + assertTrue("The same directory name in fallback link should be shaded", + afterFallback.size() == 1); + Path[] fallbackArray = new Path[afterFallback.size()]; + // Only dir2 should be listed as fallback link + assertEquals("Path did not match" , + dir2, afterFallback.toArray(fallbackArray)[0]); + } + } } From 059092f831fa3362925ce40079e3921ec4ed687e Mon Sep 17 00:00:00 2001 From: Abhishek Das Date: Wed, 13 May 2020 15:04:17 -0700 Subject: [PATCH 2/6] HADOOP-17024. Added the same change in ViewFs to cover FileContext based fs impl. --- .../org/apache/hadoop/fs/viewfs/ViewFs.java | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java index 2c8c1a538e433..0687ead2edffe 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java @@ -25,10 +25,12 @@ import java.net.URISyntaxException; import java.util.ArrayList; import java.util.EnumSet; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.conf.Configuration; @@ -954,6 +956,7 @@ public int getUriDefaultPort() { public FileStatus[] listStatus(final Path f) throws AccessControlException, IOException { checkPathIsSlash(f); + FileStatus[] fallbackStatuses = listStatusForFallbackLink(); FileStatus[] result = new FileStatus[theInternalDir.getChildren().size()]; int i = 0; for (Entry> iEntry : @@ -979,7 +982,39 @@ public FileStatus[] listStatus(final Path f) throws AccessControlException, myUri, null)); } } - return result; + if (fallbackStatuses.length > 0) { + return consolidateFileStatuses(fallbackStatuses, result); + } else { + return result; + } + } + + private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, + FileStatus[] mountPointStatuses) { + ArrayList result = new ArrayList<>(); + Set pathSet = new HashSet<>(); + int i = 0; + for (FileStatus status : mountPointStatuses) { + result.add(status); + pathSet.add(status.getPath().getName()); + } + for (FileStatus status : fallbackStatuses) { + if (!pathSet.contains(status.getPath().getName())) { + result.add(status); + } + } + return result.toArray(new FileStatus[0]); + } + + private FileStatus[] listStatusForFallbackLink() throws IOException { + if (theInternalDir.isRoot() && theInternalDir.getFallbackLink() != null) { + URI fallBackUri = theInternalDir.getFallbackLink().targetDirLinkList[0]; + ChRootedFileSystem linkedFs = (ChRootedFileSystem) + theInternalDir.getFallbackLink().getTargetFileSystem(); + return linkedFs.getMyFs().listStatus(new Path(fallBackUri.toString())); + } else { + return new FileStatus[0]; + } } @Override From 93200c650a0ad448c03e89da9b1f6e66732a15d9 Mon Sep 17 00:00:00 2001 From: Abhishek Das Date: Wed, 13 May 2020 15:09:29 -0700 Subject: [PATCH 3/6] HADOOP-17024. Fixed build issue. --- .../src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java index 0687ead2edffe..b84a085b5c5ca 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java @@ -1009,7 +1009,7 @@ private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, private FileStatus[] listStatusForFallbackLink() throws IOException { if (theInternalDir.isRoot() && theInternalDir.getFallbackLink() != null) { URI fallBackUri = theInternalDir.getFallbackLink().targetDirLinkList[0]; - ChRootedFileSystem linkedFs = (ChRootedFileSystem) + ChRootedFs linkedFs = (ChRootedFs) theInternalDir.getFallbackLink().getTargetFileSystem(); return linkedFs.getMyFs().listStatus(new Path(fallBackUri.toString())); } else { From c17bc407000d842e77c0d907134e54bb8ad82842 Mon Sep 17 00:00:00 2001 From: Abhishek Das Date: Thu, 14 May 2020 01:07:00 -0700 Subject: [PATCH 4/6] HADOOP-17024. Fix style issues. --- .../hadoop/fs/viewfs/TestViewFileSystemLinkFallback.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 6914f1d1dc42a..63cbd8609ebe6 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 @@ -265,7 +265,7 @@ public void testConfLinkFallbackWithMountPoint() throws Exception { /** * This tests whether the fallback link gets listed for list operation - * of root directory of mount table + * of root directory of mount table. * @throws Exception */ @Test @@ -295,7 +295,7 @@ public void testListingWithFallbackLink() throws Exception { assertTrue("Listing didn't include fallback link", afterFallback.size() == 1); Path[] fallbackArray = new Path[afterFallback.size()]; - assertEquals("Path did not match" , + assertEquals("Path did not match", dir1, afterFallback.toArray(fallbackArray)[0]); } } @@ -303,7 +303,7 @@ public void testListingWithFallbackLink() throws Exception { /** * This tests whether fallback directory gets shaded during list operation * of root directory of mount table when the same directory name exists as - * mount point as well as in the fallback linked directory + * mount point as well as in the fallback linked directory. * @throws Exception */ @Test @@ -338,7 +338,7 @@ public void testListingWithFallbackLinkWithSameMountDirectories() afterFallback.size() == 1); Path[] fallbackArray = new Path[afterFallback.size()]; // Only dir2 should be listed as fallback link - assertEquals("Path did not match" , + assertEquals("Path did not match", dir2, afterFallback.toArray(fallbackArray)[0]); } } From 46988ede0a6935c2a323a42cd8a68ca3ed1279d0 Mon Sep 17 00:00:00 2001 From: Abhishek Das Date: Fri, 15 May 2020 02:09:43 -0700 Subject: [PATCH 5/6] HADOOP-17024. Addressed code review comments --- .../hadoop/fs/viewfs/ViewFileSystem.java | 16 +++++++++---- .../org/apache/hadoop/fs/viewfs/ViewFs.java | 16 +++++++++---- .../TestViewFileSystemLinkFallback.java | 23 ++++++++++++++++--- 3 files changed, 42 insertions(+), 13 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 a6523eea37ee9..15f7983c6a674 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 @@ -1238,7 +1238,6 @@ private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, FileStatus[] mountPointStatuses) { ArrayList result = new ArrayList<>(); Set pathSet = new HashSet<>(); - int i = 0; for (FileStatus status : mountPointStatuses) { result.add(status); pathSet.add(status.getPath().getName()); @@ -1252,11 +1251,18 @@ private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, } private FileStatus[] listStatusForFallbackLink() throws IOException { - if (theInternalDir.isRoot() && theInternalDir.getFallbackLink() != null) { - URI fallBackUri = theInternalDir.getFallbackLink().targetDirLinkList[0]; - ChRootedFileSystem linkedFs = (ChRootedFileSystem) + if (theInternalDir.isRoot() && + theInternalDir.getFallbackLink() != null) { + FileSystem linkedFs = theInternalDir.getFallbackLink().getTargetFileSystem(); - return linkedFs.getMyFs().listStatus(new Path(fallBackUri.toString())); + // Fallback link is only applicable for root + FileStatus[] statuses = linkedFs.listStatus(new Path("/")); + for (FileStatus status : statuses) { + // Fix the path back to viewfs scheme + status.setPath( + new Path(myUri.toString(), status.getPath().getName())); + } + return statuses; } else { return new FileStatus[0]; } diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java index b84a085b5c5ca..938d01b41206f 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java @@ -993,7 +993,6 @@ private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, FileStatus[] mountPointStatuses) { ArrayList result = new ArrayList<>(); Set pathSet = new HashSet<>(); - int i = 0; for (FileStatus status : mountPointStatuses) { result.add(status); pathSet.add(status.getPath().getName()); @@ -1007,11 +1006,18 @@ private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, } private FileStatus[] listStatusForFallbackLink() throws IOException { - if (theInternalDir.isRoot() && theInternalDir.getFallbackLink() != null) { - URI fallBackUri = theInternalDir.getFallbackLink().targetDirLinkList[0]; - ChRootedFs linkedFs = (ChRootedFs) + if (theInternalDir.isRoot() && + theInternalDir.getFallbackLink() != null) { + AbstractFileSystem linkedFs = theInternalDir.getFallbackLink().getTargetFileSystem(); - return linkedFs.getMyFs().listStatus(new Path(fallBackUri.toString())); + // Fallback link is only applicable for root + FileStatus[] statuses = linkedFs.listStatus(new Path("/")); + for (FileStatus status : statuses) { + // Fix the path back to viewfs scheme + status.setPath( + new Path(myUri.toString(), status.getPath().getName())); + } + return statuses; } else { return new FileStatus[0]; } 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 63cbd8609ebe6..7266ad7b52768 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 @@ -295,8 +295,17 @@ public void testListingWithFallbackLink() throws Exception { assertTrue("Listing didn't include fallback link", afterFallback.size() == 1); Path[] fallbackArray = new Path[afterFallback.size()]; + afterFallback.toArray(fallbackArray); + Path expected = new Path(viewFsUri.toString(), "dir1"); assertEquals("Path did not match", - dir1, afterFallback.toArray(fallbackArray)[0]); + expected, fallbackArray[0]); + + // Create a directory using the returned fallback path and verify + Path childDir = new Path(fallbackArray[0], "child"); + vfs.mkdirs(childDir); + FileStatus status = fsTarget.getFileStatus(new Path(dir1, "child")); + assertTrue(status.isDirectory()); + assertTrue(vfs.getFileStatus(childDir).isDirectory()); } } @@ -337,9 +346,17 @@ public void testListingWithFallbackLinkWithSameMountDirectories() assertTrue("The same directory name in fallback link should be shaded", afterFallback.size() == 1); Path[] fallbackArray = new Path[afterFallback.size()]; - // Only dir2 should be listed as fallback link + // Only user1 should be listed as fallback link + Path expected = new Path(viewFsUri.toString(), "user1"); assertEquals("Path did not match", - dir2, afterFallback.toArray(fallbackArray)[0]); + expected, afterFallback.toArray(fallbackArray)[0]); + + // Create a directory using the returned fallback path and verify + Path childDir = new Path(fallbackArray[0], "child"); + vfs.mkdirs(childDir); + FileStatus status = fsTarget.getFileStatus(new Path(dir2, "child")); + assertTrue(status.isDirectory()); + assertTrue(vfs.getFileStatus(childDir).isDirectory()); } } } From fb4bf895ce5d6896823bdf6f9ea52ef222a9abf8 Mon Sep 17 00:00:00 2001 From: Abhishek Das Date: Mon, 18 May 2020 16:05:16 -0700 Subject: [PATCH 6/6] HADOOP-17024. Updated javadoc for listStatus --- .../main/java/org/apache/hadoop/fs/viewfs/InodeTree.java | 6 +++--- .../java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java | 8 ++++++++ .../src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java index b3b2d663f2556..50c839b52b654 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java @@ -154,11 +154,11 @@ INodeLink getFallbackLink() { return fallbackLink; } - void addFallbackLink(INodeLink fallbackLink) throws IOException { + void addFallbackLink(INodeLink link) throws IOException { if (!isRoot) { - throw new IOException("fallbackLink can only be set for root"); + throw new IOException("Fallback link can only be added for root"); } - this.fallbackLink = fallbackLink; + this.fallbackLink = link; } Map> getChildren() { 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 15f7983c6a674..0cbcafce0eb8a 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 @@ -1200,6 +1200,14 @@ public FileStatus getFileStatus(Path f) throws IOException { } + /** + * {@inheritDoc} + * + * Note: listStatus on root("/") considers listing from fallbackLink if + * available. If the same directory name is present in configured mount + * path as well as in fallback link, then only the configured mount path + * will be listed in the returned result. + */ @Override public FileStatus[] listStatus(Path f) throws AccessControlException, FileNotFoundException, IOException { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java index 938d01b41206f..607bdb8d423a0 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java @@ -952,6 +952,14 @@ public int getUriDefaultPort() { return -1; } + /** + * {@inheritDoc} + * + * Note: listStatus on root("/") considers listing from fallbackLink if + * available. If the same directory name is present in configured mount + * path as well as in fallback link, then only the configured mount path + * will be listed in the returned result. + */ @Override public FileStatus[] listStatus(final Path f) throws AccessControlException, IOException {