Skip to content

Conversation

@ebyhr
Copy link
Contributor

@ebyhr ebyhr commented Oct 18, 2025

Fixes #14337

@github-actions github-actions bot added the core label Oct 18, 2025
Copy link
Contributor

@singhpk234 singhpk234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the change @ebyhr

it would be really nice to add an UT for it.

if (current == null
|| !Objects.equals(current.metadataFileLocation(), response.metadataLocation())) {
this.current = response.tableMetadata();
this.current = checkUUID(current, response.tableMetadata());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for this fix. Also +1 for adding a test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. Added a unit test.

Comment on lines +185 to +266
String newUUID = newMetadata.uuid();
if (currentMetadata != null && currentMetadata.uuid() != null && newUUID != null) {
Preconditions.checkState(
newUUID.equals(currentMetadata.uuid()),
"Table UUID does not match: current=%s != refreshed=%s",
currentMetadata.uuid(),
newUUID);
}

return newMetadata;
Copy link
Contributor

@singhpk234 singhpk234 Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional to consider] wonder if we can move this to some place common validate(current, newMetadata) so that both BaseMetaStoreOperation and TableOperation (may be an util or just default impl of TableOps) can share it, but seems too much for ROI.

catalog.createNamespace(TABLE.namespace());
catalog.createTable(TABLE, SCHEMA);

// inject the wrong table UUID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: simulate drop and re-create the table with same name

@ebyhr ebyhr force-pushed the ebi/rest-check-uuid branch from a5e470f to e914843 Compare October 29, 2025 11:33
@ebyhr
Copy link
Contributor Author

ebyhr commented Oct 29, 2025

Rebased on main to resolve conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RESTTableOperations refresh does not enforce Table UUID check

3 participants