-
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
ddl: fix corrupted default value for bit type column #18036
ddl: fix corrupted default value for bit type column #18036
Conversation
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
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
Do we need cherry-pick this PR to v4.0, v3.1, and v3.0? |
Sure. Let's pick manually since there will be lots of conflicts(the parser also needs to be picked). |
Codecov Report
@@ Coverage Diff @@
## master #18036 +/- ##
================================================
+ Coverage 79.3606% 79.5217% +0.1610%
================================================
Files 546 546
Lines 150465 149710 -755
================================================
- Hits 119410 119052 -358
+ Misses 21524 21141 -383
+ Partials 9531 9517 -14 |
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 |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
/run-all-tests |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
LGTM |
@AndreMouche,Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments.See the corresponding SIG page for more information. Related SIG: ddl(slack). |
@tangenta merge failed. |
@tangenta, please update your pull request. |
@tangenta, please update your pull request. |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-3.0 in PR #20339 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-4.0 in PR #20340 |
Signed-off-by: ti-srebot <[email protected]>
What problem does this PR solve?
Issue Number: close #17641 close #17642
Problem Summary:
The
ColumnInfo.OriginDefaultValue
is corrupted when the column type isBIT
.BIT
type column values are stored as strings by JSON marshaling and read it by unmarshaling later. However, the data in a string can be changed in this case:If we store it as []byte, the problem disappeared. This is how
DefaultValueBit
works.The same problem exists in
OriginDefaultValue
. PR #12168 tried to restore theOriginDefaultValue
fromDefaultValueBit
in the getter, butOriginDefaultValue
is different fromDefaultValue
:OriginDefaultValue
is used to skip the backfilling phase ofAddColumn()
. If a column's default value is modified byALTER TABLE MODIFY COLUMN DEFAULT
, they are not equal anymore(see the example in #17641).What is changed and how it works?
This PR adds a field
OriginDefaultValueBit
toColumnInfo
, which borrows fromDefaultValueBit
to solve the problem completely.Proposal: xxx
What's Changed:
OriginDefaultValue
.How it Works:
If the column type is
BIT
, set/get the content withOriginDefaultValueBit
.Related changes
Check List
Tests
Side effects
Release note