ddl: fix the issue that "rename column" fails when changing column type concurrently (#32993) #33035
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.
cherry-pick #32993 to release-5.2
You can switch your code base to this Pull Request by using git-extras:
# In tidb repo: git pr https://github.com/pingcap/tidb/pull/33035
After apply modifications, you can push your change to this PR via:
What problem does this PR solve?
Issue Number: close #31075
Problem Summary:
In session 1:
alter table t change column b b double;
(DDL1)In session 2:
alter table t rename column b to c;
(DDL2)Decode the ModifyColumn's args:
job.DecodeArgs(&jobParam.newCol, &jobParam.oldColName, jobParam.pos, &jobParam.modifyColumnTp, &jobParam.updatedAutoRandomBits, &jobParam.changingCol, &jobParam.changingIdxs)
The rename column uses the ModifyColumn job. But the rename column uses 4 args.
After running DDL1, we do DDL2 need to change column type with data. So we will add
changingCol
andchangingIdxs
to args but notupdatedAutoRandomBits
. So it will return an error.What is changed and how it works?
Add
updatedAutoRandomBits
to the rename column operation.Check List
Tests
Side effects
Documentation
Release note