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


##########
core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:
##########
@@ -2356,8 +2358,8 @@ private void updateCatalogProperty(
    * removes the catalog entity left behind by a failed publication.
    */
   private void rollbackFailedCatalogCreate(
-      NameIdentifier ident, List<SecretMaterial> secretMaterials, boolean 
entityStored) {
-    secretManager.rollbackSecrets(secretMaterials);
+      NameIdentifier ident, SecretVersionChanges stagedSecrets, boolean 
entityStored) {
+    secretManager.rollbackSecrets(stagedSecrets);

Review Comment:
   **High:** When `entityStored` is true, secrets are rolled back before 
`store.delete`. If delete fails, the catalog entity can remain while 
write-through URNs point at deleted versions — a broken catalog until manual 
repair.
   
   Consider deleting the entity first (or only rolling secrets back after a 
successful delete), and surfacing a stronger error if delete fails.



##########
core/src/main/java/org/apache/gravitino/catalog/FilesetOperationDispatcher.java:
##########
@@ -222,16 +222,17 @@ public Fileset createMultipleLocationFileset(
                                       ident, comment, type, storageLocations, 
updatedProperties)),
                       NoSuchSchemaException.class,
                       FilesetAlreadyExistsException.class));
-      return EntityCombinedFileset.of(createdFileset)
-          .withHiddenProperties(
-              getMaskAndOmitKeys(
-                  catalogIdent,
-                  HasPropertyMetadata::filesetPropertiesMetadata,
-                  createdFileset.properties()));
     } catch (RuntimeException e) {
-      secretManager.rollbackSecrets(secretMaterials);
+      secretManager.rollbackSecrets(stagedSecrets);

Review Comment:
   **Medium:** Unconditional rollback on any create failure. Schema create uses 
`createdInCatalog` and retains secrets once the external resource exists 
(design doc §5.5.3 / `testCreateKeepsSecretsOnceFilesetIsCreated`).
   
   Today this is mostly masked because catalog create is atomic and 
`commitSecrets` runs before response masking, but a later failure inside this 
`try` (registration/hook/combined entity) would delete secrets while the 
fileset still references them. Consider mirroring the schema guard.



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