Repository navigation
Conversation
Contributor
Author
|
@zhangbutao @dengzhhu653 Please help review, thanks in advance! |
dengzhhu653
reviewed
Nov 21, 2026
| boolean dataWasMoved = false; | ||
| boolean isPartitionedTable = false; | ||
| // Location of the new table as passed in by the caller, kept so it can be put back on failure. | ||
| String originalNewLocation = null; |
Member
There was a problem hiding this comment.
Nice catch! can you try creating a new table by newt.deepCopy() at the beginning?
Contributor
Author
There was a problem hiding this comment.
Nice catch! can you try creating a new table by
newt.deepCopy()at the beginning?
Yes, I used deepcopy to implement it at first, and then changed it to the plan of saving location.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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