tengqm commented on code in PR #6045:
URL: https://github.com/apache/gravitino/pull/6045#discussion_r1903608715


##########
core/src/main/java/org/apache/gravitino/hook/CatalogHookDispatcher.java:
##########
@@ -126,8 +126,19 @@ public boolean dropCatalog(NameIdentifier ident) {
   @Override
   public boolean dropCatalog(NameIdentifier ident, boolean force)
       throws NonEmptyEntityException, CatalogInUseException {
-    AuthorizationUtils.authorizationPluginRemovePrivileges(ident, 
Entity.EntityType.CATALOG);
-    return dispatcher.dropCatalog(ident, force);
+    // If we call the authorization plugin after dropping catalog, we can't 
load the plugin of the
+    // catalog
+    Catalog catalog = null;
+    if (dispatcher.catalogExists(ident)) {
+      catalog = dispatcher.loadCatalog(ident);
+    }

Review Comment:
   Got it. I wasn't suggesting that this is a right or wrong issue.
   It is in a gray area, which means we have to cope with it carefully.
   We'd better have a clear mindset / protocol on this.
   
   > If we occurs some errors, we would throw exceptions.
   
   This, again, leads us to the situation of multiple exit conditions. We may 
return `true`/`false` AND we may throw exceptions. That is not a good design 
for primitive functions. There are two options that are simpler and clearer:
   
   - Ensure that no exception will be thrown from this function, AND we return 
a boolean to indicate whether the operation was successful. This means we need 
to catch the underlying exception(s) and stop propagating them in the call 
stack.
   - Remove the boolean return value. This function either succeeds (silently) 
or fails with an exception. Hopefully, the exception will be caught very soon 
before it is causing further misbehaviors.
   
   



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