LuciferYang opened a new pull request, #14983:
URL: https://github.com/apache/gravitino/pull/14983

   ### What changes were proposed in this pull request?
   
   Catalog, schema and fileset create now use the secret lifecycle of alter, as 
#14970 proposes.
   
   - `assembleSecretMaterials` is renamed to `assembleSecretPlaintexts` and 
returns property key → plaintext.
   - Create passes those plaintexts to `stageSecrets`, now public, with no 
start properties. The new URNs have no current version, so each first version 
is current once written and `commitSecrets` switches nothing.
   - A failed create calls `rollbackSecrets(SecretVersionChanges)`, which 
deletes the written versions; `commitSecrets` runs outside that scope, as in 
alter. A schema created in the external catalog keeps its versions, and a 
fileset now keeps them once the catalog has stored it.
   - `writeSecrets(List)`, `rollbackSecrets(List)` and `SecretMaterial` are 
removed, and `SecretMaterialsHolder` is renamed to `SecretVersionChangesHolder`.
   - `SecretProvider` signatures and `deleteSecretsFromProperties` are 
unchanged; the `writeSecretVersion` Javadoc now says create uses the version 
methods.
   - Design doc §5.5.3 covers create; the `setProperty` and `setSecretBinding` 
alter rows, stale since #14954, now describe versions.
   
   ### Why are the changes needed?
   
   `SecretManager` had one lifecycle for create and another for alter, and 
`SecretMaterial` existed only for create. Callers now follow one: stage, commit 
once the entity exists, roll back if the create fails before that.
   
   Fix: #14970
   
   ### Does this PR introduce _any_ user-facing change?
   
   A write-through provider that does not implement the version methods now 
fails at create with `UnsupportedOperationException`, instead of at the first 
alter of that secret. The SPI is not released yet.
   
   ### How was this patch tested?
   
   - `TestSecretManager`: staging and committing a create, rolling back a 
failed create, and a provider without versions later in the batch deleting the 
versions written before it.
   - `TestSchemaOperationDispatcher.testSecrets`, 
`TestFilesetOperationDispatcher.testCreateWithSecrets`: a create that fails 
before the entity exists deletes its version.
   - 
`TestFilesetOperationDispatcher.testCreateKeepsSecretsOnceFilesetIsCreated`: a 
failure after the catalog created the fileset keeps its secret.
   


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