HIVE-30265: Table rename retried by RetryingHMSHandler leaves partitions at the old location #6967
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 234 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.327
Real PR Conversation Timeline
1 comments
"Review active on #6967"
general
weight: 0.35
cxzl25
What changes were proposed in this pull request?
HiveAlterHandler.alterTablerewrites the location of the new table object passed in by the caller when it handles a rename that has to move data. This PR keeps the original value and restores it in thefinallyblock when the transaction did not commit.HiveAlterHandler: record the caller's location at the two places that rewrite it (managed table rename and translated-to-external table rename), and restore it beforerollbackTransaction()on failure. The restore comes first because the rollback itself may throw.TestAlterTableRenameWithHMSHandlerRetry: new test that fails the firstalterPartitionscall with aJDODataStoreExceptionand checks the state after the retry.Why are the changes needed?
RetryingHMSHandlerretries a failed call with the same argument objects. The rename flow is selected by comparing the old and the new table location:After a first attempt that failed past newt.getSd().setLocation(destPath.toString()), the retry sees a location that differs from the old one and treats the call as a rename with a caller-specified location. It commits the new table name and table location, does not move the data and does not update partition locations, and returns success.
The table keeps working because the partitions still point at the old directory. The damage comes later: once another table uses the old name, both tables share partition directories, and dropping the renamed managed table deletes the other table's data.
Does this PR introduce _any_ user-facing change?
No
How was this patch tested?
Add UT