-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
txn: change check logic for column type change for amend #22150
Conversation
session/schema_amender.go
Outdated
// is newly added or modified from an original column.Report error to solve the issue | ||
// https://github.com/pingcap/tidb/issues/21470. This change will make amend fail for adding column | ||
// and modifying columns at the same time. | ||
return nil, errors.Trace(errors.Errorf("column=%v id=%v is not found for table=%v checking column modify", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok to make add-column amend fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single add-column will not fail, change type containing add column with modify/change column will.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that errors.Errorf
will attach stack info, thus I think errors.Trace
is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the function's comment at L193 needs to be updated?
LGTM |
7cdfb07
to
2978a3d
Compare
2978a3d
to
c8d1457
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
/run-all-tests |
What problem does this PR solve?
Issue Number: close #21470
Problem Summary:
On the 5.0 or the master branch, the change column ddl may NOT keep the original column id as in the release-4.0 branch, checking the modify colum action type in amend phase could not decide whether it's a newly added column or if this column type change is accepatable, so report error for such branches.
What is changed and how it works?
What's Changed:
Report error for checking modify colum action type if the column could not be found in early schema version though column type change is not GA release currently. This change will make the amend fail for ddl change with both adding column and modifying column.
How it Works:
Related changes
Check List
Tests
Side effects
Release note