umamaheswararao commented on a change in pull request #2088:
URL: https://github.com/apache/hadoop/pull/2088#discussion_r443824394
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
##########
@@ -1258,40 +1260,52 @@ public FileStatus getFileStatus(Path f) throws
IOException {
FileStatus status =
((ChRootedFileSystem)link.getTargetFileSystem())
.getMyFs().getFileStatus(new Path(linkedPath));
- result[i++] = new FileStatus(status.getLen(), status.isDirectory(),
- status.getReplication(), status.getBlockSize(),
- status.getModificationTime(), status.getAccessTime(),
- status.getPermission(), status.getOwner(), status.getGroup(),
- null, path);
+ linkStatuses.add(
+ new FileStatus(status.getLen(), status.isDirectory(),
+ status.getReplication(), status.getBlockSize(),
+ status.getModificationTime(), status.getAccessTime(),
+ status.getPermission(), status.getOwner(),
+ status.getGroup(), null, path));
} catch (FileNotFoundException ex) {
LOG.warn("Cannot get one of the children's(" + path
+ ") target path(" + link.getTargetFileSystem().getUri()
+ ") file status.", ex);
throw ex;
}
} else {
- result[i++] =
+ internalDirStatuses.add(
new FileStatus(0, true, 0, 0, creationTime, creationTime,
PERMISSION_555, ugi.getShortUserName(),
- ugi.getPrimaryGroupName(), path);
+ ugi.getPrimaryGroupName(), path));
}
}
+ FileStatus[] internalDirStatusesMergedWithFallBack = internalDirStatuses
+ .toArray(new FileStatus[internalDirStatuses.size()]);
if (fallbackStatuses.length > 0) {
- return consolidateFileStatuses(fallbackStatuses, result);
+ internalDirStatusesMergedWithFallBack =
+ merge(fallbackStatuses, internalDirStatusesMergedWithFallBack);
+ }
+
+ // we don't use target file status as we show the mount link as symlink.
+ if (showMountLinksAsSymlinks) {
+ return merge(internalDirStatusesMergedWithFallBack,
+ linkStatuses.toArray(new FileStatus[linkStatuses.size()]));
Review comment:
HI @ayushtkn ,
The file actually creates under the above mount link you added.
```
ConfigUtil.addLink(conf, "/user1/hive/warehouse/partition-0",
new Path(targetTestRoot.toString()).toUri());
```
Once you have mounted a path, links are more prioritized in ViewFS. I don't
see a requirement people will configure files as mount links. We only support
dirs. That dir takes the precedence. You will loose complete access to
fallback, once you added mount path link. Tricky case here is, when you have
matching file at fallback, you no more see that file. That you configured to
represent as dir from mount view. we don't create anything under file in
fallback fs.
in SymLinks enabled, isFile always should be false. I think raised a good
point that we don't need that if condition where its making fallback high
precedence and making think wrong in symlink enabled case. I will removed it
and verify. I think I overthought there.
To make thing clear:
Mount tree links will have higher precendence.
Fallback dirs have higher precedence compared to moount tree internal dir.
If no matching mount tree internal dirs will have as last precedence.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]