deniskuzZ commented on code in PR #6977:
URL: https://github.com/apache/hive/pull/6977#discussion_r4694722613
##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -424,16 +426,27 @@ private void renameTableOrView(
Table table = clients.run(client -> client.getTable(fromDatabase,
fromName));
validateTableIsIcebergTableOrView(contentType, table,
CatalogUtil.fullTableName(name, from));
+ String metadataLocation =
table.getParameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP);
table.setDbName(toDatabase);
table.setTableName(to.name());
clients.run(client -> {
- MetastoreUtil.alterTable(client, fromDatabase, fromName, table);
+ MetastoreUtil.alterTable(client, fromDatabase, fromName, table,
Review Comment:
This follows #6930's rule that the lock and the CAS are alternatives. A
rename holds no HMS lock when it alters: the SQL path's hook unlocks in
commitAlterTable before Catalogs.renameTable, and the catalog API never locks.
So the CAS is its only guard, whatever the lock mode.
Could you say so in a comment, so nobody later "aligns" it with the hook's
lock-only branch? For example:
````
// The alter sends the whole table back. A rename holds no HMS lock, so the
metadata_location CAS keeps it
// from reverting a commit that landed since the read.
````
--
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]