[
https://issues.apache.org/jira/browse/HADOOP-18122?focusedWorklogId=759545&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-759545
]
ASF GitHub Bot logged work on HADOOP-18122:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 20/Apr/22 20:25
Start Date: 20/Apr/22 20:25
Worklog Time Spent: 10m
Work Description: 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()?
Issue Time Tracking
-------------------
Worklog Id: (was: 759545)
Time Spent: 2h 40m (was: 2.5h)
> ViewFileSystem fails on determining owning group when primary group doesn't
> exist for user
> ------------------------------------------------------------------------------------------
>
> Key: HADOOP-18122
> URL: https://issues.apache.org/jira/browse/HADOOP-18122
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Chentao Yu
> Assignee: Chentao Yu
> Priority: Major
> Labels: pull-request-available
> Time Spent: 2h 40m
> Remaining Estimate: 0h
>
> ViewFileSystem should not fail on determining owning group when primary group
> doesn't exist for user
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]