-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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, meta: allow increasing auto_random bits #17423
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17423 +/- ##
================================================
- Coverage 79.7675% 79.4591% -0.3085%
================================================
Files 525 524 -1
Lines 144184 141362 -2822
================================================
- Hits 115012 112325 -2687
+ Misses 19993 19958 -35
+ Partials 9179 9079 -100 |
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.
Rest 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
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
@@ -585,17 +588,20 @@ func (w *worker) onModifyColumn(t *meta.Meta, job *model.Job) (ver int64, _ erro | |||
oldColName := &model.CIStr{} | |||
pos := &ast.ColumnPosition{} | |||
var modifyColumnTp byte | |||
err := job.DecodeArgs(newCol, oldColName, pos, &modifyColumnTp) | |||
var updatedAutoRandomBits uint64 | |||
err := job.DecodeArgs(newCol, oldColName, pos, &modifyColumnTp, &updatedAutoRandomBits) |
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.
The DDL owner is an old-version TiDB: auto_random shard bits remain unchanged(but DDL successfully executed).
It will not cause data inconsistency, but it will confuse the user, the execution is successful, but the function is not successful.
@@ -585,17 +588,20 @@ func (w *worker) onModifyColumn(t *meta.Meta, job *model.Job) (ver int64, _ erro | |||
oldColName := &model.CIStr{} | |||
pos := &ast.ColumnPosition{} | |||
var modifyColumnTp byte | |||
err := job.DecodeArgs(newCol, oldColName, pos, &modifyColumnTp) | |||
var updatedAutoRandomBits uint64 | |||
err := job.DecodeArgs(newCol, oldColName, pos, &modifyColumnTp, &updatedAutoRandomBits) |
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.
At the moment, I don’t seem to have any good methods other than the newly added types. Or you ask if the DBA can accept this situation
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 |
@tangenta merge failed. |
/run-common-test |
What problem does this PR solve?
Issue Number: close #17422
Problem Summary:
What is changed and how it works?
Proposal: xxx
What's Changed:
ModifyColumn
: newAutoRandBits.How it Works:
To make sure the new
auto_random
bits number does not affect the correctness of implicit allocation, the check is as follows:If the length of the incremental bit in the new layout is greater than those in the origin layout, it is safe to switch to the new layout.
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
Release note
auto_random
bits is allowed to increase byALTER TABLE
if possible.