owenmonn opened a new issue, #19262: URL: https://github.com/apache/iceberg/issues/19262
### Apache Iceberg version 1.12.0 (latest release) ### Query engine None ### Please describe the bug 🐞 `HiveTableOperations` can retry a lock-free commit that HMS already applied. The retry moves the branch back to that commit's snapshot, so snapshots that other writers committed after it disappear from the branch. ## What happens With `engine.hive.lock-enabled=false`, a resent `alter_table` whose first attempt was applied is rejected with "The table has been modified". The strict commit status check from #12637 then looks for the new metadata location in the current metadata and its metadata log, which keeps at most `write.metadata.previous-versions-max` entries. Once later commits have pushed the applied location out of the log, the check reports a failure, and the retry finds its snapshot ID already in the table and sets the branch back to that snapshot. With the default of 100 entries this takes more than 100 later commits, so tables that keep a short metadata log are the ones at risk. ## Reproduction 1. Create a table with `engine.hive.lock-enabled=false` and `write.metadata.previous-versions-max=1`. 2. Register a metastore event listener whose `onAlterTable` sleeps for 8 seconds once, and set `hive.metastore.client.socket.timeout=3s`. The listener runs after the update is committed, so it only delays the response. 3. Append a file. While the response is delayed, another writer appends two files to the same table. ``` MetaStoreClient lost connection. Attempting to reconnect (1 of 1) after 1s. alter_table_with_environmentContext MetaException(message:The table has been modified. The parameter value for key 'metadata_location' is '.../00003-<uuid>.metadata.json'. The expected was value was '.../00000-<uuid>.metadata.json') Retrying task after failure: sleepTimeMs=100 The table hivedb.repro_upd has been modified concurrently ``` The append returns without an error. Afterwards `main` points back to the appended snapshot, so the other writer's two snapshots are no longer among its ancestors, and a scan returns only the appended file. ## Proposed fix When the new location is not found, fail only while the location the new metadata was built on is still current or in the metadata log, and report an unknown commit state otherwise (as in trinodb/trino#31213). ### Willingness to contribute - [x] I can contribute a fix for this bug independently - [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community - [ ] I cannot contribute a fix for this bug at this time -- 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]
