Anurag-S1ngh opened a new pull request, #19244: URL: https://github.com/apache/iceberg/pull/19244
## Summary - `HiveCatalog.renameTableOrView` loads the table from HMS, rewrites the database and table name, and calls `alter_table` with the whole table object. If a commit lands between the read and the rename, the rename writes back the older `metadata_location`. The table then points at the previous metadata and the new snapshot disappears. - The rename now sends the same `metadata_location` compare-and-swap that lock-free commits use, in both lock modes, because the rename path never takes the HMS lock. If the table has no `metadata_location`, no check is sent. ## Changes - `HiveCatalog`: read `metadata_location` before mutating the HMS table and pass it to `MetastoreUtil.alterTable` through the environment context (`expected_parameter_key` / `expected_parameter_value`). - `TestHiveCatalog`: add `testRenameDoesNotRevertConcurrentCommit`. The test renames with a stale table read while HMS holds a newer `metadata_location`, then verifies the rename fails and the committed location is preserved. ## Testing - `./gradlew :iceberg-hive-metastore:test --tests "org.apache.iceberg.hive.TestHiveCatalog"` passes. - The new test fails on the unmodified `HiveCatalog` and passes with the change. - `spotlessApply` run for the module. Closes #19211 -- 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]
