sririshindra opened a new pull request, #3682:
URL: https://github.com/apache/polaris/pull/3682
Add support for the new overwrite boolean on RegisterTableRequest (default:
false) so clients can register a metadata location that replaces an existing
table pointer. Implement register-table overwrite semantics:
If overwrite=false (default): preserve existing behavior โ attempting to
register a table that already exists returns a conflict/error. If
overwrite=true:
If the table does not exist: create it (normal register). If the table
exists: update the table's metadata-location to the provided value (do not
throw AlreadyExists). Ensure safety/backward-compatibility:
overwrite defaults to false so existing clients are unaffected. Validate
provided metadata location where possible before committing to avoid corrupting
catalog state.
Details / rationale:
The change implements the REST Catalog spec extension that adds an overwrite
flag to RegisterTableRequest. This enables clients to atomically point an
existing table identifier at a new metadata file (useful for moving or
restoring table metadata). Because overwrite changes the set of operations
allowed on an existing table, we had to be careful with authorization and
entity resolution: When performing an overwrite against an existing table, the
handler enforces the UPDATE_TABLE privilege (mapped to TABLE_WRITE_PROPERTIES)
rather than REGISTER_TABLE. This prevents callers who only have create
permissions from silently replacing another principal's table pointer. We fixed
a subtle distinction where lack of read privileges could be mistaken for a
non-existent table. The handler now distinguishes "truly not found" from
"exists but unreadable" and applies the correct required privilege accordingly.
Resolution manifest and passthrough-path population were adjusted so downstream
overwri
te logic can locate the namespace and table entries reliably. Files /
components touched (high level):
Tests added/updated:
- DTO unit tests: overwrite deserialization for `RegisterTableRequest`
(true/false/missing).
- Integration / behavior tests (integration-tests module):
- Register new table with `overwrite=false` โ success.
- Register existing table with `overwrite=false` โ conflict / exception as
before.
- Register existing table with `overwrite=true` โ success and the table's
metadata-location is updated atomically.
- Authorization tests: updated/added unit tests to assert `UPDATE_TABLE`
(TABLE_WRITE_PROPERTIES) is enforced for overwrite against existing tables.
- Unit tests: added `CatalogHandlerUtilsTest` to cover handler helper logic.
<!--
๐ Describe what changes you're proposing, especially breaking or user-facing
changes.
๐ See https://github.com/apache/polaris/blob/main/CONTRIBUTING.md for more.
-->
## Checklist
- [ ] ๐ก๏ธ Don't disclose security issues! (contact [email protected])
- [ ] ๐ Clearly explained why the changes are needed, or linked related
issues: Fixes #
- [ ] ๐งช Added/updated tests with good coverage, or manually tested (and
explained how)
- [ ] ๐ก Added comments for complex logic
- [ ] ๐งพ Updated `CHANGELOG.md` (if needed)
- [ ] ๐ Updated documentation in `site/content/in-dev/unreleased` (if needed)
--
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]