markhoerth opened a new pull request, #14475: URL: https://github.com/apache/gravitino/pull/14475
Backport to branch-1.3 of the fix for #14473. Same change as the PR to main; the dispatcher is wired where branch-1.3 builds its owner dispatcher. ### What changes were proposed in this pull request? - New `OwnerPropertySyncDispatcher` in the public owner dispatcher chain (`OwnerEventManager` -> `OwnerPropertySyncDispatcher` -> `OwnerManager`). After `setOwner` or `setOwners` succeeds, it rewrites the `owner` property of each namespace or table in a `lakehouse-iceberg` catalog that has one, through the internal schema and table dispatchers. Objects without the property, such as those created through the Gravitino API, are left alone. Ownership has already changed when this runs, so a failed update is logged and does not fail the transfer. The internal owner dispatcher used by the IRC create hooks is unchanged, since the property already names the first owner. - New `IcebergOwnerPropertyGuard`, applied by the IRC table and namespace executors: `owner` is dropped from `set-properties` and `remove-properties` in table commits and from namespace property updates and removals. A commit that creates a table (staged create) sets it to the committing user, as a direct create does. The key is dropped rather than rejected because engines send it on their own, for example Spark adds the current user as `owner` on CREATE OR REPLACE, and rejecting it would fail those statements. ### Why are the changes needed? Gravitino and engines gave different answers for an object's owner, and the property could be set to any name. Fixes #14473 ### Does this PR introduce _any_ user-facing change? Yes. An ownership transfer updates the `owner` property of IRC-created namespaces and tables; IRC property updates no longer change it. Objects transferred before this change keep their old value until their next transfer. ### How was this patch tested? - `TestOwnerPropertySyncDispatcher`: a transfer rewrites the property of an Iceberg table and namespace; objects without it or outside Iceberg catalogs are untouched; a failed property update does not fail the transfer; a failed transfer does not touch the property. - `TestIcebergOwnerPropertyGuard`: commits and namespace updates cannot set or remove `owner`; a create commit sets it to the committer; other requests are unchanged. `./gradlew :core:test --tests '*Owner*' :iceberg:iceberg-rest-server:test -PskipITs` 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Eu6fb9pLfmrSJzGQDVLi1g -- 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]
