jerryshao commented on code in PR #2873:
URL: https://github.com/apache/gravitino/pull/2873#discussion_r1975076605


##########
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:
   Write lock is not acceptable.



-- 
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]

Reply via email to