lasdf1234 opened a new pull request, #11809:
URL: https://github.com/apache/gravitino/pull/11809
### What changes were proposed in this pull request?
Implement Iceberg REST `POST .../namespaces/{ns}/register` support for
`RegisterTableRequest.overwrite=true`:
- Add `RegisterTableOverwrite` with CAS metastore pointer swap for JDBC,
memory, and Hive backends (does not write a new metadata file via
`TableOperations.commit`).
- Wire 3-arg `registerTable(..., overwrite)` through
`JdbcCatalogWithMetadataLocationSupport`,
`MemoryCatalogWithMetadataLocationSupport`, and
`HiveCatalogWithMetadataLocationSupport`.
- Pass `request.overwrite()` through `FederatedCatalogWrapper` (federation
path previously ignored the flag).
- In `IcebergNamespaceHookDispatcher`, skip Gravitino entity import and
ownership assignment when `overwrite=true` so existing `table_id` and
role/owner/tag/policy bindings are preserved.
### Why are the changes needed?
Fix: #11059
Without `overwrite=true`, re-registering an existing table requires drop +
register, which is non-atomic and can mint a new Gravitino table entity,
orphaning bindings keyed on the old `table_id`.
### Does this PR introduce _any_ user-facing change?
Yes. IRC clients can now pass `overwrite=true` on registerTable to
atomically repoint an existing table registration at a new metadata.json
location.
### How was this patch tested?
- `./gradlew :iceberg:iceberg-common:test --tests
org.apache.iceberg.jdbc.TestJdbcCatalogWithMetadataLocationSupport --tests
org.apache.iceberg.memory.TestMemoryCatalogWithMetadataLocationSupport
-PskipITs`
- `./gradlew :iceberg:iceberg-rest-server:test --tests
org.apache.gravitino.iceberg.service.TestCatalogWrapperForREST --tests
org.apache.gravitino.iceberg.service.dispatcher.TestIcebergNamespaceHookDispatcher
-PskipITs`
Made with [Cursor](https://cursor.com)
--
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]