singhpk234 commented on code in PR #14363:
URL: https://github.com/apache/iceberg/pull/14363#discussion_r2442509676
##########
core/src/main/java/org/apache/iceberg/rest/RESTTableOperations.java:
##########
@@ -175,12 +175,25 @@ private TableMetadata
updateCurrentMetadata(LoadTableResponse response) {
// safely ignored. there is no requirement to update config on refresh or
commit.
if (current == null
|| !Objects.equals(current.metadataFileLocation(),
response.metadataLocation())) {
- this.current = response.tableMetadata();
+ this.current = checkUUID(current, response.tableMetadata());
}
return current;
}
+ private static TableMetadata checkUUID(TableMetadata currentMetadata,
TableMetadata newMetadata) {
+ 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;
Review Comment:
[optional to consider] wonder if we can move this to some place common
`validate(current, newMetadata)` so that both BaseMetaStoreOperation and
TableOperation (may be just put it in TableOperation default impl) can share
it, but seems too much for ROI.
##########
core/src/main/java/org/apache/iceberg/rest/RESTTableOperations.java:
##########
@@ -175,12 +175,25 @@ private TableMetadata
updateCurrentMetadata(LoadTableResponse response) {
// safely ignored. there is no requirement to update config on refresh or
commit.
if (current == null
|| !Objects.equals(current.metadataFileLocation(),
response.metadataLocation())) {
- this.current = response.tableMetadata();
+ this.current = checkUUID(current, response.tableMetadata());
Review Comment:
This seems reasonable to me
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]