jerryshao commented on code in PR #2873:
URL: https://github.com/apache/gravitino/pull/2873#discussion_r1975050442
##########
core/src/main/java/org/apache/gravitino/authorization/PermissionManager.java:
##########
@@ -67,7 +69,10 @@ User grantRolesToUser(String metalake, List<String> roles,
String user) {
try {
List<RoleEntity> roleEntitiesToGrant = Lists.newArrayList();
for (String role : roles) {
- roleEntitiesToGrant.add(roleManager.getRole(metalake, role));
+ TreeLockUtils.doWithTreeLock(
+ AuthorizationUtils.ofRole(metalake, role),
+ LockType.READ,
+ () -> roleEntitiesToGrant.add(roleManager.getRole(metalake,
role)));
Review Comment:
I guess with the overhead of requesting multiple read lock, the performance
may not be as good as request one parent read lock. I would be inclined to use
the old way, what do you think?
--
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]