pvary commented on issue #6370: URL: https://github.com/apache/iceberg/issues/6370#issuecomment-1356124377
Maybe something like this: ``` diff --git a/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift b/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift index 179a4960b9..6a3f9e40fa 100644 --- a/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift +++ b/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift @@ -22,7 +22,7 @@ # Thrift Service that the MetaStore is built on # -include "share/fb303/if/fb303.thrift" +include "/Users/petervary/tmp/fb303.thrift" namespace java org.apache.hadoop.hive.metastore.api namespace php metastore @@ -2165,7 +2165,9 @@ struct AlterTableRequest { 6: optional i64 writeId=-1, 7: optional string validWriteIdList 8: optional list<string> processorCapabilities, - 9: optional string processorIdentifier + 9: optional string processorIdentifier, + 10: optional string expectedPropertyKey, + 12: optional string expectedPropertyValue // TODO: also add cascade here, out of envCtx } diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java index 1226cd1a1a..0b12e68401 100644 --- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java +++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java @@ -102,7 +102,7 @@ public void setConf(Configuration conf) { @Override public void alterTable(RawStore msdb, Warehouse wh, String catName, String dbname, String name, Table newt, EnvironmentContext environmentContext, - IHMSHandler handler, String writeIdList) + IHMSHandler handler, String writeIdList, String expectedKey, String expectedValue) throws InvalidOperationException, MetaException { catName = normalizeIdentifier(catName); name = name.toLowerCase(); @@ -187,6 +187,11 @@ public void alterTable(RawStore msdb, Warehouse wh, String catName, String dbnam TableName.getQualified(catName, dbname, name) + " doesn't exist"); } + if (expectedKey != null && !oldt.getParameters().get(expectedKey).equals(expectedValue)) { + throw new MetaException("The table already modified. The parameter value for key: " + expectedKey + " is " + + oldt.getParameters().get(expectedKey) + ". The expected was value was " + expectedValue); + } + validateTableChangesOnReplSource(olddb, oldt, newt, environmentContext); // On a replica this alter table will be executed only if old and new both the databases are ``` -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org