lasdf1234 commented on code in PR #12420:
URL: https://github.com/apache/gravitino/pull/12420#discussion_r3773877021


##########
core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:
##########
@@ -975,9 +1008,12 @@ public boolean dropCatalog(NameIdentifier ident, boolean 
force)
             // Finally, delete the catalog entity as well as all its 
sub-entities from the store.
             // Invalidate after store.delete() to prevent a background thread 
from repopulating
             // the cache with stale data between invalidate and delete.
+            Map<String, String> catalogProperties =
+                catalogWrapper.catalog().entity().getProperties();
             boolean deleted = store.delete(ident, EntityType.CATALOG, true);

Review Comment:
   Before deleting the catalog/schema, first note down the properties 
(including URNs) of the sub-schemas and filesets. After successfully deleting 
the entity, call the function "deleteSecretsFromProperties" to remove their 
write-through secrets.



##########
core/src/main/java/org/apache/gravitino/catalog/SchemaOperationDispatcher.java:
##########
@@ -331,6 +363,21 @@ public boolean dropSchema(NameIdentifier ident, boolean 
cascade) throws NonEmpty
         catalogIdent,
         LockType.WRITE,
         () -> {
+          // Capture persisted properties (including write-through secret 
URNs) before drop so we
+          // can clean provider material after a successful delete. 
External-ref URNs are skipped by
+          // deleteSecretsFromProperties.
+          Map<String, String> schemaProperties = null;
+          try {
+            Schema schema =
+                doWithCatalog(
+                    catalogIdent,
+                    c -> c.doWithSchemaOps(s -> s.loadSchema(ident)),
+                    NoSuchSchemaException.class);
+            schemaProperties = schema.properties();

Review Comment:
   Fixed: pre-drop catalog `loadSchema` now catches unexpected exceptions, logs 
a warning, and continues the drop. Secret cleanup prefers entity-store 
properties and falls back to catalog props when available.



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