mchades commented on code in PR #14120:
URL: https://github.com/apache/gravitino/pull/14120#discussion_r4344466002


##########
catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java:
##########
@@ -925,71 +894,24 @@ public boolean dropSchema(NameIdentifier ident, boolean 
cascade) throws NonEmpty
           
Optional.ofNullable(schemaEntity.properties()).orElse(Collections.emptyMap());
       Map<String, Path> schemaPaths = getAndCheckSchemaPaths(ident.name(), 
properties);
 
-      boolean dropped = super.dropSchema(ident, cascade);
-      if (disableFSOps) {
-        // No FS cleanup; still remove fileset write-through secrets when 
cascade deleted them.
-        // Schema secrets are cleaned by SchemaOperationDispatcher.
-        if (dropped && cascade) {
-          for (FilesetEntity fileset : filesets) {
-            secretManager.deleteSecretsFromProperties(fileset.properties());
-          }
+      // Catalog force-drop reaches this method without 
SchemaOperationDispatcher's fileset
+      // cleanup. Drop each fileset before its schema so a storage failure 
preserves the failed
+      // fileset and its parent for retry. Stop at the first failure; earlier 
drops stay committed.
+      if (cascade) {
+        for (FilesetEntity fileset : filesets) {
+          dropFilesetAndGet(fileset.nameIdentifier())
+              .ifPresent(
+                  deleted -> 
secretManager.deleteSecretsFromProperties(deleted.properties()));
         }
-        return dropped;
       }
 
+      boolean dropped = super.dropSchema(ident, cascade);
       // If the schema entity is failed to be deleted, we should not delete 
the storage location
       // and return false immediately.
-      if (!dropped) {
-        return false;
+      if (!dropped || disableFSOps) {
+        return dropped;
       }

Review Comment:
   Changed the final call to `super.dropSchema(ident, false)` and added a 
comment explaining the guard. The new regression test creates a fileset after 
enumeration and verifies its metadata, storage, and secret are preserved until 
retry.



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