hemanthumashankar0511 opened a new pull request, #6977:
URL: https://github.com/apache/hive/pull/6977

   
   
   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: 
https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: 
https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., 
'[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a 
faster review.
   
   -->
   
   ### 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; retry rename 
works.
   
   ### 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`.
   


-- 
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]

Reply via email to