virajith commented on code in PR #3987:
URL: https://github.com/apache/hadoop/pull/3987#discussion_r854521755
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java:
##########
@@ -1917,6 +1940,10 @@ public Collection<? extends BlockStoragePolicySpi>
getAllStoragePolicies()
}
return allPolicies;
}
+
+ private FsPermission getMountLinkDefaultPermissions() {
+ return PERMISSION_555;
Review Comment:
Do you want to make this configurable as well?
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java:
##########
@@ -1705,4 +1710,59 @@ public void testInvalidMountPoints() throws Exception {
ex.getMessage().startsWith("URISyntax exception"));
}
}
+
+ @Test
+ public void testInternalDirectoryOwnership() throws Exception {
+ Configuration localConf = new Configuration(conf);
+ FileSystem fs = FileSystem.get(FsConstants.VIEWFS_URI, localConf);
+
+ // Check default owner/group.
+ final UserGroupInformation currentUser =
+ UserGroupInformation.getCurrentUser();
+ FileStatus status = fs.getFileStatus(new Path("/internalDir"));
+ assertEquals(currentUser.getUserName(), status.getOwner());
Review Comment:
currentUser.getShortUserName()?
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java:
##########
@@ -1705,4 +1710,59 @@ public void testInvalidMountPoints() throws Exception {
ex.getMessage().startsWith("URISyntax exception"));
}
}
+
+ @Test
+ public void testInternalDirectoryOwnership() throws Exception {
+ Configuration localConf = new Configuration(conf);
+ FileSystem fs = FileSystem.get(FsConstants.VIEWFS_URI, localConf);
+
+ // Check default owner/group.
+ final UserGroupInformation currentUser =
+ UserGroupInformation.getCurrentUser();
+ FileStatus status = fs.getFileStatus(new Path("/internalDir"));
+ assertEquals(currentUser.getUserName(), status.getOwner());
+ assertEquals(currentUser.getGroupNames()[0], status.getGroup());
Review Comment:
currentUser.getPrimaryGroupName()?
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java:
##########
@@ -1022,4 +1024,38 @@ public Object run() throws Exception {
});
}
+ public void testInternalDirectoryOwnership() throws IOException {
+ Configuration localConf = new Configuration(conf);
+ FileContext fc = FileContext.getFileContext(
+ FsConstants.VIEWFS_URI, localConf);
+
+ // check default owner/group
+ final UserGroupInformation currentUser =
+ UserGroupInformation.getCurrentUser();
+ FileStatus status = fc.getFileStatus(new Path("/internalDir"));
+ assertEquals(currentUser.getUserName(), status.getOwner());
Review Comment:
currentUser.getShortUserName()?
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java:
##########
@@ -973,18 +976,27 @@ static class InternalDirOfViewFs extends
AbstractFileSystem {
final URI myUri; // the URI of the outer ViewFs
private InodeTree<AbstractFileSystem> fsState;
private Configuration conf;
+ private String mountLinkUserName;
+ private String mountLinkGroupName;
public InternalDirOfViewFs(final InodeTree.INodeDir<AbstractFileSystem>
dir,
final long cTime, final UserGroupInformation ugi, final URI uri,
- InodeTree fsState, Configuration conf)
- throws URISyntaxException {
+ InodeTree fsState, Configuration conf) throws URISyntaxException,
IOException {
super(FsConstants.VIEWFS_URI, FsConstants.VIEWFS_SCHEME, false, -1);
theInternalDir = dir;
creationTime = cTime;
this.ugi = ugi;
myUri = uri;
this.fsState = fsState;
this.conf = conf;
+ mountLinkUserName = conf.get(CONFIG_VIEWFS_MOUNT_LINKS_USER_NAME);
Review Comment:
may be write this as conf.get(CONFIG_VIEWFS_MOUNT_LINKS_USER_NAME) == null ?
ugi.getShortUserName() : conf.get(CONFIG_VIEWFS_MOUNT_LINKS_USER_NAME) and
explain why you are not using conf.get(CONFIG_VIEWFS_MOUNT_LINKS_USER_NAME,
ugi.getShortUserName()) in a comment? Otherwise, it's unclear why you aren't
using that method directly. Same for the other places where you are using this
template
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java:
##########
@@ -1022,4 +1024,38 @@ public Object run() throws Exception {
});
}
+ public void testInternalDirectoryOwnership() throws IOException {
+ Configuration localConf = new Configuration(conf);
+ FileContext fc = FileContext.getFileContext(
+ FsConstants.VIEWFS_URI, localConf);
+
+ // check default owner/group
+ final UserGroupInformation currentUser =
+ UserGroupInformation.getCurrentUser();
+ FileStatus status = fc.getFileStatus(new Path("/internalDir"));
+ assertEquals(currentUser.getUserName(), status.getOwner());
+ assertEquals(currentUser.getGroupNames()[0], status.getGroup());
Review Comment:
currentUser.getPrimaryGroupName()?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]