Skip to content

HBASE-26662 User.createUserForTesting should not reset UserProvider.groups every time if hbase.group.service.for.test.only is true - #4029

Merged
wchevreuil merged 1 commit into
apache:masterfrom
wchevreuil:HBASE-26662-master
Jan 18, 2022
Merged

Conversation

@wchevreuil

Copy link
Copy Markdown
Contributor

No description provided.

…roups every time if hbase.group.service.for.test.only is true
@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 3sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall4m 51smaster passed
+1 💚compile0m 27smaster passed
+1 💚shadedjars8m 24sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 28smaster passed
_ Patch Compile Tests _
+1 💚mvninstall4m 36sthe patch passed
+1 💚compile0m 28sthe patch passed
+1 💚javac0m 28sthe patch passed
+1 💚shadedjars8m 27spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 25sthe patch passed
_ Other Tests _
+1 💚unit2m 3shbase-common in the patch passed.
32m 38s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#4029
Optional Testsjavac javadoc unit shadedjars compile
unameLinux fb935207cd35 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 3a14cfc
Default JavaAdoptOpenJDK-11.0.10+9
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/testReport/
Max. process+thread count291 (vs. ulimit of 30000)
modulesC: hbase-common U: hbase-common
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 11sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall4m 42smaster passed
+1 💚compile0m 24smaster passed
+1 💚shadedjars9m 8sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23smaster passed
_ Patch Compile Tests _
+1 💚mvninstall4m 16sthe patch passed
+1 💚compile0m 23sthe patch passed
+1 💚javac0m 23sthe patch passed
+1 💚shadedjars9m 2spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 20sthe patch passed
_ Other Tests _
+1 💚unit1m 54shbase-common in the patch passed.
33m 1s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#4029
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 0c284ddb29e3 4.15.0-153-generic #160-Ubuntu SMP Thu Jul 29 06:54:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 3a14cfc
Default JavaAdoptOpenJDK-1.8.0_282-b08
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/testReport/
Max. process+thread count229 (vs. ulimit of 30000)
modulesC: hbase-common U: hbase-common
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 33sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+1 💚mvninstall4m 28smaster passed
+1 💚compile0m 55smaster passed
+1 💚checkstyle0m 26smaster passed
+1 💚spotbugs0m 51smaster passed
_ Patch Compile Tests _
+1 💚mvninstall4m 8sthe patch passed
+1 💚compile0m 52sthe patch passed
+1 💚javac0m 52sthe patch passed
+1 💚checkstyle0m 25sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck20m 48sPatch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚spotbugs0m 57sthe patch passed
_ Other Tests _
+1 💚asflicense0m 13sThe patch does not generate ASF License warnings.
43m 11s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#4029
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile
unameLinux 7f5c5cc73646 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 3a14cfc
Default JavaAdoptOpenJDK-1.8.0_282-b08
Max. process+thread count96 (vs. ulimit of 30000)
modulesC: hbase-common U: hbase-common
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-4029/1/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache9

Copy link
Copy Markdown
Contributor

Could you please describe your usage more? I do not fully understand wha's the problem here...

@wchevreuil

wchevreuil commented Jan 17, 2022

Copy link
Copy Markdown
ContributorAuthor

Could you please describe your usage more? I do not fully understand wha's the problem here...

Sure. As mentioned in the jira description, the "if" check below will always unnecessarily reset static var UserProvider.groups to a newly created instance of TestingGroups every time SecureHadoopUser.createUserForTesting is called.

 if (!(UserProvider.groups instanceof TestingGroups) ||
conf.getBoolean(TestingGroups.TEST_CONF, false)) {
UserProvider.groups = new TestingGroups(UserProvider.groups);
}

That will cause all users but the latest one created in a test to be missed in the TestingGroups cache from UserProvider.groups, falling back to the underlying hadoop Groups own group caching. I believe this extra check in SecureHadoopUser.createUserForTesting is redundant. We should only make sure to wrap the underlying Groups implementation once, in the first time we pass through that code, when testing.

I bumped into this when running TestAccessController.testGetUsersPermissions against a hadoop version that includes HADOOP-17079. The changes introduced by HADOOP-17079 around several classes of the hadoop security framework have broken TestAccessController as below:

2022-01-17 17:54:47,648 WARN [RpcServer.default.FPBQ.Fifo.handler=2,queue=0,port=50198] security.ShellBasedUnixGroupsMapping(218): unable to return groups for user globalGroupUser1
PartialGroupNameException The user name globalGroupUser1 is not found. id: globalGroupUser1: no such user
id: globalGroupUser1: no such user
at org.apache.hadoop.security.ShellBasedUnixGroupsMapping.resolvePartialGroupNames(ShellBasedUnixGroupsMapping.java:291)
at org.apache.hadoop.security.ShellBasedUnixGroupsMapping.getUnixGroups(ShellBasedUnixGroupsMapping.java:215)
at org.apache.hadoop.security.ShellBasedUnixGroupsMapping.getGroupsSet(ShellBasedUnixGroupsMapping.java:123)
at org.apache.hadoop.security.Groups$GroupCacheLoader.fetchGroupSet(Groups.java:413)
at org.apache.hadoop.security.Groups$GroupCacheLoader.load(Groups.java:351)
at org.apache.hadoop.security.Groups$GroupCacheLoader.load(Groups.java:300)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
at com.google.common.cache.LocalCache.get(LocalCache.java:3953)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3976)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4960)
at org.apache.hadoop.security.Groups.getGroupInternal(Groups.java:258)
at org.apache.hadoop.security.Groups.getGroups(Groups.java:216)
at org.apache.hadoop.hbase.security.User$TestingGroups.getGroups(User.java:420)
at org.apache.hadoop.hbase.security.access.AccessChecker.getUserGroups(AccessChecker.java:484)
at org.apache.hadoop.hbase.security.access.PermissionStorage.parsePermissionRecord(PermissionStorage.java:642)
at org.apache.hadoop.hbase.security.access.PermissionStorage.parsePermissions(PermissionStorage.java:603)
at org.apache.hadoop.hbase.security.access.PermissionStorage.getPermissions(PermissionStorage.java:540)
at org.apache.hadoop.hbase.security.access.PermissionStorage.getUserPermissions(PermissionStorage.java:585)
at org.apache.hadoop.hbase.master.MasterRpcServices.getUserPermissions(MasterRpcServices.java:2845)

TestAccessController used to pass before this change only because it implements its own ShellBasedUnixGroupsMapping, overriding getGroups method. But after HADOOP-17079, a new method getGroupsSet has been introduced and is the one that gets called by hadoop security Groups class when fetching the groups cache.

@Apache9Apache9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was wondering why we have the second check but as you said, seems redundant as it will always be true when using TestingGroups.

+1

@wchevreuil
wchevreuil merged commit 4a94cfc into apache:masterJan 18, 2022
wchevreuil added a commit that referenced this pull request Jan 18, 2022
…roups every time if hbase.group.service.for.test.only is true (#4029)
Signed-off-by: Josh Elser <elserj@apache.org>
Signrd-off-by: Duo Zhang <zhangduo@apache.org>
wchevreuil added a commit that referenced this pull request Jan 18, 2022
…roups every time if hbase.group.service.for.test.only is true (#4029)
Signed-off-by: Josh Elser <elserj@apache.org>
Signrd-off-by: Duo Zhang <zhangduo@apache.org>
wchevreuil added a commit that referenced this pull request Jan 18, 2022
…roups every time if hbase.group.service.for.test.only is true (#4029)
Signed-off-by: Josh Elser <elserj@apache.org>
Signrd-off-by: Duo Zhang <zhangduo@apache.org>
vinayakphegde pushed a commit to vinayakphegde/hbase that referenced this pull request Apr 4, 2024
…roups every time if hbase.group.service.for.test.only is true (apache#4029)
Signed-off-by: Josh Elser <elserj@apache.org>
Signrd-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit b38c88b)
Change-Id: I1ac3620a8aefd0e833b90efb1356891b7c836dae
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wchevreuil@Apache-HBase@Apache9@joshelser