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


##########
core/src/main/java/org/apache/gravitino/hook/CatalogHookDispatcher.java:
##########
@@ -126,8 +126,20 @@ 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
+    Runnable removePrivilegesCallback = null;
+    if (dispatcher.catalogExists(ident)) {
+      removePrivilegesCallback =
+          AuthorizationUtils.createRemovePrivilegesCallback(ident, 
Entity.EntityType.CATALOG);
+    }
+
+    boolean dropped = dispatcher.dropCatalog(ident, force);
+
+    if (dropped && removePrivilegesCallback != null) {
+      removePrivilegesCallback.run();
+    }

Review Comment:
   Actually, this is the cleanup process. Deleting the entity from the store 
doesn't mean we have deleted the entity. The lifecycle of the catalog object 
don't end when we just remove it from the store. So I don't think it's 
dangerous.



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