RussellSpitzer commented on code in PR #433:
URL: https://github.com/apache/polaris/pull/433#discussion_r1842947109
##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java:
##########
@@ -1381,6 +1434,98 @@ public void doCommit(TableMetadata base, TableMetadata
metadata) {
}
}
+ /**
+ * COPIED FROM {@link BaseMetastoreTableOperations} but without the
requirement that base ==
+ * current()
+ *
+ * @param base table metadata on which changes were based
+ * @param metadata new table metadata with updates
+ */
+ @Override
+ public void commit(TableMetadata base, TableMetadata metadata) {
+ TableMetadata currentMetadata = current();
+
+ // if the metadata is already out of date, reject it
+ if (base == null) {
+ if (currentMetadata != null) {
+ // when current is non-null, the table exists. but when base is
null, the commit is trying
+ // to create the table
+ throw new AlreadyExistsException("Table already exists: %s",
tableName());
+ }
+ } else if (base.metadataFileLocation() != null
+ &&
!base.metadataFileLocation().equals(currentMetadata.metadataFileLocation())) {
+ throw new CommitFailedException("Cannot commit: stale table metadata");
+ } else if (base != currentMetadata) {
+ // This branch is different from BaseMetastoreTableOperations
+ LOGGER.debug(
+ "Base object differs from current metadata; proceeding because
locations match");
+ }
+
+ // if the metadata is not changed, return early
+ if (base == metadata) {
Review Comment:
should we fix this too? if base.path != metadata.path
--
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]