Skip to content

HIVE-30234: Iceberg: HiveCatalog rename can revert a concurrent commit's metadata_location - #6977

Open
hemanthumashankar0511 wants to merge 1 commit into
apache:masterfrom
hemanthumashankar0511:iceberg_concurrency
Open

hemanthumashankar0511 wants to merge 1 commit into
apache:masterfrom
hemanthumashankar0511:iceberg_concurrency

Conversation

@hemanthumashankar0511

@hemanthumashankar0511 hemanthumashankar0511 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Send metadata_location CAS on HiveCatalog rename (same as no-lock commits) and fail with CommitFailedException on concurrent modify.

Why are the changes needed?

Rename could overwrite HMS params and silently drop a concurrent Iceberg snapshot.

Does this PR introduce any user-facing change?

Yes, concurrent rename now fails loudly instead of losing data

How was this patch tested?

Ran new unit test mvn test -pl iceberg/iceberg-catalog -Dtest=TestHiveCatalogRenameConcurrency

Tez on Yarn Integration test

Started the cluster in debug mode:
mvn test -Pitests,tez-yarn -pl itests/tez-yarn-it -Dtest=StartTezYarnCluster -Dmaven.surefire.debug
Attached the IDE debugger to port 5005 and set a thread breakpoint in HiveCatalog.renameTableOrView after getTable (before alterTable).

Opened two Beeline sessions to HiveServer2 (session 1 and 2):
beeline -u 'jdbc:hive2://localhost:10000/default;auth=noSasl' -n hive

In session 2, created the table and inserted the first row (no-lock mode for embedded Derby):

CREATE TABLE ice_t (id INT) STORED BY ICEBERG TBLPROPERTIES ('engine.hive.lock-enabled'='false');
INSERT INTO ice_t VALUES (1);

In session 1, started a rename and paused on the breakpoint:
ALTER TABLE ice_t RENAME TO ice_t2;

In session 2, while 1 was paused, committed a concurrent write:
INSERT INTO ice_t VALUES (2);

Resumed the debugger. With the fix, session A’s rename failed (concurrent modification), SELECT * FROM ice_t still returned both rows, and a second ALTER TABLE ice_t RENAME TO ice_t2 completed successfully with both rows visible on ice_t2.

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants