nevzheng opened a new issue, #14271:
URL: https://github.com/apache/gravitino/issues/14271
### Version
main branch
### Describe what's wrong
`ViewHookDispatcher` runs its side effects after the catalog has committed
the change, and lets their
exceptions reach the client:
- **Create.** `createView` creates the view, then calls
`OwnerDispatcher#setOwner`. If `setOwner` fails
(a store error, or the creator is not a user of the metalake), the view
exists but the client gets an
error, and the create-failure event fires. A retry gets
`ViewAlreadyExistsException`. The view has no
owner, so the creator cannot alter or drop it; only an admin can fix it.
- **Rename to the same name.** `alterView` applies the changes, then calls
`AuthorizationUtils.authorizationPluginRenamePrivileges`. With
authorization enabled, that builds
`MetadataObjectChange.rename(old, new)`, which throws
`IllegalArgumentException("The metadata object must be different!")` when
the new name equals the old
one. The rename (and any other change in the same request) has already
been applied, but the client
sees an error. The REST request check only rejects a blank new name, so
such a rename reaches the
catalog.
`TableHookDispatcher` follows the same pattern.
### Error message and/or stacktrace
```
java.lang.IllegalArgumentException: The metadata object must be different!
```
For create, the error is whatever `setOwner` threw.
### How to reproduce
1. Enable authorization (`gravitino.authorization.enable=true`).
2. Create view `v` while `setOwner` fails (for example a store error while
writing the owner; in a unit
test, a `ViewHookDispatcher` over a mock `OwnerDispatcher` that throws).
The request fails, but `v`
exists, has no owner, and creating it again returns "already exists".
3. Rename an existing view `v` to `v`. The request fails with the error
above, although the alter was
applied.
Expected: a create either succeeds with an owner or fails without leaving a
view; a same-name rename is
rejected before the catalog applies it, or treated as a no-op.
### Additional context
Possible fixes: reject a same-name rename in request validation before the
catalog call; for create,
decide whether the owner write should happen before the commit, or be
retried and logged instead of
returned to the client.
--
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]