abhishekdas99 commented on a change in pull request #2010: URL: https://github.com/apache/hadoop/pull/2010#discussion_r425671597
########## File path: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java ########## @@ -1226,7 +1229,38 @@ public FileStatus getFileStatus(Path f) throws IOException { myUri, null)); } } - return result; + if (fallbackStatuses.length > 0) { + return consolidateFileStatuses(fallbackStatuses, result); + } else { + return result; + } + } + + private FileStatus[] consolidateFileStatuses(FileStatus[] fallbackStatuses, + FileStatus[] mountPointStatuses) { + ArrayList<FileStatus> result = new ArrayList<>(); + Set<String> 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]; Review comment: I totally agree with your thought. Changed the path back to viewfs. Also in the unit test, verified the creation of directory with the returned path. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org