xunliu commented on code in PR #6515:
URL: https://github.com/apache/gravitino/pull/6515#discussion_r1974875914


##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java:
##########
@@ -576,8 +576,9 @@ public Boolean onGrantedRolesToUser(List<Role> roles, User 
user)
               try {
                 rangerClient.grantRole(rangerServiceName, 
grantRevokeRoleRequest);
               } catch (RangerServiceException e) {
-                // Ignore exception, support idempotent operation
-                LOG.warn("Grant role: {} to user: {} failed!", role, user, e);
+                throw new AuthorizationPluginException(
+                    "Fail to grant role %s to user %s, exception: %s",
+                    role.name(), user.name(), e.getMessage());
               }

Review Comment:
   Another consideration as to why you don't throw an exception is to support 
idempotent operations.
   Gravitino -> Ranger
   Maybe the data was deleted in the last operation of the Ranger, and now it's 
being operated again. You can't throw an exception.
   If you want to throw an exception, you have to cover the idempotent 
operation, with a test case.



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