-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-18122. ViewFileSystem fails on determining owning group when primary group doesn't exist for user #3987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just had a cursory look. This I don't think will fix the bug, but will just give a workaround like, if you don't have a primaryGroup get this config set and you can dodge it?
Why didn't we try something like:
https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/records/MountTable.java#L152-L153
Secondly, Why is user name also made configurable?
Thirdly, Just saw the commit:
virajith authored and cheyu2022 committed
seems you are using some wrong author?
fyi. @virajith
...p-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
Outdated
Show resolved
Hide resolved
...p-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
Outdated
Show resolved
Hide resolved
...p-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
Outdated
Show resolved
Hide resolved
...-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
Outdated
Show resolved
Hide resolved
...-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
Outdated
Show resolved
Hide resolved
You are right about this. This fix is more like a workaround. But even this solution above sounds like a workaround as well - it just assumes if group isn't found, use username. I'm ok with either way.
Mount points can essentially have any user names, thus make it configurable as well.
Yeah nice catch, I will fix that. |
2e67eb4
to
8aabc9e
Compare
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets go ahead with the conf way only
...p-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
Outdated
Show resolved
Hide resolved
8aabc9e
to
be45af5
Compare
🎊 +1 overall
This message was automatically generated. |
...-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
Outdated
Show resolved
Hide resolved
be45af5
to
f8954a2
Compare
🎊 +1 overall
This message was automatically generated. |
Kindly ask for a +1 and ship this @ayushtkn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of setting this, a cleaner way is to declare mountLinkGroupName as a final variable and return ugi.getPrimaryGroupName() here. Same goes for the implementation of getMountLinkUserName()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively, just set mountLinkGroupName to ugi.getPrimaryGroupName() in the constructor if the config is not set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go with the second option, updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip for future - leave the comment unresolved so that the person who asked for the change can resolve it. It makes it easier for the reviewer to see what changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, for the second option we changed the behavior by setting mountLinkGroupName
to ugi.getPrimaryGroupName()
in the constructor, since before we only set it on demand when we call listStatus()
, getFileStatus()
, etc... Not sure this behavior change will cause other problems but this failed some unit tests like testListStatusWithNoGroups
with error "There is no primary group for UGI" when we initialize InternalDirOfViewFs
. Because in the test we don't expect the error during filesystem initialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For your first suggested option:
I think the idea of setting mountLinkGroupName
in this function is to not call ugi.getPrimaryGroupName()
every time we call this get method. We set mountLinkGroupName
once if it's null then there's no need to call ugi.getPrimaryGroupName()
again.
…rimary group doesn't exist for user
} | ||
|
||
private FsPermission getMountLinkDefaultPermissions() { | ||
return PERMISSION_555; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to make this configurable as well?
final UserGroupInformation currentUser = | ||
UserGroupInformation.getCurrentUser(); | ||
FileStatus status = fs.getFileStatus(new Path("/internalDir")); | ||
assertEquals(currentUser.getUserName(), status.getOwner()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentUser.getShortUserName()?
UserGroupInformation.getCurrentUser(); | ||
FileStatus status = fs.getFileStatus(new Path("/internalDir")); | ||
assertEquals(currentUser.getUserName(), status.getOwner()); | ||
assertEquals(currentUser.getGroupNames()[0], status.getGroup()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentUser.getPrimaryGroupName()?
final UserGroupInformation currentUser = | ||
UserGroupInformation.getCurrentUser(); | ||
FileStatus status = fc.getFileStatus(new Path("/internalDir")); | ||
assertEquals(currentUser.getUserName(), status.getOwner()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentUser.getShortUserName()?
UserGroupInformation.getCurrentUser(); | ||
FileStatus status = fc.getFileStatus(new Path("/internalDir")); | ||
assertEquals(currentUser.getUserName(), status.getOwner()); | ||
assertEquals(currentUser.getGroupNames()[0], status.getGroup()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentUser.getPrimaryGroupName()?
myUri = uri; | ||
this.fsState = fsState; | ||
this.conf = conf; | ||
mountLinkUserName = conf.get(CONFIG_VIEWFS_MOUNT_LINKS_USER_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
💔 -1 overall
This message was automatically generated. |
Description of PR
ViewFileSystem should not fail on determining owning group when primary group doesn't exist for user
How was this patch tested?
new unit test; run existing unit tests
mvn test -Dtest=TestViewFileSystem*
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?