lasdf1234 commented on code in PR #14954:
URL: https://github.com/apache/gravitino/pull/14954#discussion_r4560844404
##########
core/src/main/java/org/apache/gravitino/catalog/FilesetOperationDispatcher.java:
##########
@@ -335,6 +336,7 @@ private Fileset alterFilesetWithPreparedSecrets(
NoSuchFilesetException.class,
IllegalArgumentException.class);
alterCommitted = true;
+ secretManager.commitSecrets(writtenSecretMaterials.get());
Review Comment:
**Medium — two issues in this alter/drop secret path (nearby code not in the
hunk).**
1. **`filesetId = 0L` (~L320)** when neither `StringIdentifier` nor
`FilesetEntity` exists. Create uses real entity ids; a `0` fallback mints
`…:fileset:0:…` URNs that later fail `isWriteThroughForEntity` / GC. Prefer
fail-fast — matches Gravitino’s stable-id model, no magic zero.
2. **`dropFileset` (~L364–383)** still snapshots URNs from catalog
`loadFileset` only, while this alter method already prefers
`FilesetEntity.properties()` because “catalog load may omit them.” Drop can
therefore skip `deleteSecretsFromProperties` and orphan provider material.
Mirror alter/schema-drop: prefer entity properties before GC.
This `commitSecrets` call itself looks correct for the prepared-secret flow.
##########
core/src/main/java/org/apache/gravitino/catalog/SchemaOperationDispatcher.java:
##########
@@ -551,7 +567,12 @@ private Pair<Schema, SchemaChange[]>
alterExternalSchemaUnderLock(
c -> c.doWithSchemaOps(s -> s.alterSchema(ident,
effectiveChanges)),
NoSuchSchemaException.class);
alterCommitted = true;
- return Pair.of(alteredSchema, effectiveChanges);
+ if (schemaEntityForSecrets == null) {
Review Comment:
**Medium — external alter with no `SchemaEntity` still used
`entityIdForSecrets = 0L` above (~L552).**
This branch commits immediately because nothing in the store references
released secrets — fine. But if prepare already wrote versions under
`schema:0:…`, you have durable provider rows tied to a sentinel id.
Please reject secret-bearing alters when id cannot be resolved (no
`StringIdentifier` / no `SchemaEntity`), instead of `0L`. Same fix as fileset
alter.
##########
catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java:
##########
@@ -758,13 +758,14 @@ public Fileset alterFileset(NameIdentifier ident,
FilesetChange... changes)
existing.properties() == null
? new HashMap<>()
: new HashMap<>(existing.properties());
- Pair<FilesetChange[], List<SecretMaterial>> secretResult =
+ Pair<FilesetChange[], PreparedSecrets> secretResult =
SecretAlterChanges.prepareFilesetChanges(
secretManager, currentProperties, existing.id(),
changes);
writtenSecretMaterials.set(secretResult.getRight());
return updateFilesetEntity(ident, existing,
secretResult.getLeft());
});
alterCommitted = true;
+ secretManager.commitSecrets(writtenSecretMaterials.get());
Review Comment:
**Low/Medium — alter commit path is good; single `dropFileset` still skips
secret GC.**
Cascade drop (~L953–955) calls `deleteSecretsFromProperties`, but
`dropFileset` / `dropFilesetAndGet` do not. Dispatcher drop cleans the API
path; direct catalog-ops drop (or callers bypassing the dispatcher) can leak.
Pick one ownership rule for Gravitino consistency: GC in catalog ops as
well, or document “secret GC is dispatcher-only” and make cascade drop
idempotent / non-double-delete.
--
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]