ddl: fix corrupted default value for bit type column#18036
ddl: fix corrupted default value for bit type column#18036ti-srebot merged 31 commits intopingcap:masterfrom
Conversation
|
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 |
|
/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 <ti-srebot@pingcap.com>
|
cherry pick to release-3.0 in PR #20339 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
|
cherry pick to release-4.0 in PR #20340 |
What problem does this PR solve?
Issue Number: close #17641 close #17642
Problem Summary:
The
ColumnInfo.OriginDefaultValueis corrupted when the column type isBIT.BITtype 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
DefaultValueBitworks.The same problem exists in
OriginDefaultValue. PR #12168 tried to restore theOriginDefaultValuefromDefaultValueBitin the getter, butOriginDefaultValueis different fromDefaultValue:OriginDefaultValueis 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
OriginDefaultValueBittoColumnInfo, which borrows fromDefaultValueBitto 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