roryqi commented on code in PR #12366:
URL: https://github.com/apache/gravitino/pull/12366#discussion_r3754663251
##########
core/src/main/java/org/apache/gravitino/hook/FilesetHookDispatcher.java:
##########
@@ -75,27 +80,42 @@ public Fileset createMultipleLocationFileset(
String comment,
Fileset.Type type,
Map<String, String> storageLocations,
- Map<String, String> properties)
+ Map<String, String> properties,
+ Map<String, SecretBinding> secretBindings,
+ Map<String, SecretReference> secretReferences)
throws NoSuchSchemaException, FilesetAlreadyExistsException {
Fileset fileset =
dispatcher.createMultipleLocationFileset(
- ident, comment, type, storageLocations, properties);
+ ident, comment, type, storageLocations, properties,
secretBindings, secretReferences);
- // Set the creator as the owner of the fileset.
- OwnerDispatcher ownerManager =
GravitinoEnv.getInstance().ownerDispatcher();
- if (ownerManager != null) {
- // The inner NormalizeDispatcher case-folds the fileset name (and its
schema namespace)
- // based on catalog capabilities, so the entity is stored under the
normalized identifier.
- // Apply the same normalization here so the owner is attached to the
same identifier the
- // manager sees.
- NameIdentifier normalizedIdent =
- CapabilityHelpers.applyCapabilities(
- ident, Capability.Scope.FILESET,
GravitinoEnv.getInstance().catalogManager());
- ownerManager.setOwner(
- normalizedIdent.namespace().level(0),
- NameIdentifierUtil.toMetadataObject(normalizedIdent,
Entity.EntityType.FILESET),
- PrincipalUtils.getCurrentUserName(),
- Owner.Type.USER);
+ try {
+ // Set the creator as the owner of the fileset.
+ OwnerDispatcher ownerManager =
GravitinoEnv.getInstance().ownerDispatcher();
+ if (ownerManager != null) {
+ // The inner NormalizeDispatcher case-folds the fileset name (and its
schema namespace)
+ // based on catalog capabilities, so the entity is stored under the
normalized identifier.
+ // Apply the same normalization here so the owner is attached to the
same identifier the
+ // manager sees.
+ NameIdentifier normalizedIdent =
+ CapabilityHelpers.applyCapabilities(
+ ident, Capability.Scope.FILESET,
GravitinoEnv.getInstance().catalogManager());
+ ownerManager.setOwner(
+ normalizedIdent.namespace().level(0),
+ NameIdentifierUtil.toMetadataObject(normalizedIdent,
Entity.EntityType.FILESET),
+ PrincipalUtils.getCurrentUserName(),
+ Owner.Type.USER);
+ }
+ } catch (Exception postHookException) {
+ LOG.warn(
+ "Failed to execute post hook operations, rolling back fileset " +
ident,
+ postHookException);
+ try {
+ dispatcher.dropFileset(ident);
Review Comment:
Should we adopt similar mechanism for other metadata objects if we rollback
the fileset meta managed by Gravitino? I don't think this is a piece of cake.
It brings inconsistence.
--
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]