-
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
*: support auto_random table option #16750
Conversation
e5f79a0
to
20a1666
Compare
Codecov Report
@@ Coverage Diff @@
## master #16750 +/- ##
===========================================
Coverage 80.5344% 80.5344%
===========================================
Files 507 507
Lines 138491 138491
===========================================
Hits 111533 111533
Misses 18299 18299
Partials 8659 8659 |
infoschema/builder.go
Outdated
@@ -74,7 +74,7 @@ func (b *Builder) ApplyDiff(m *meta.Meta, diff *model.SchemaDiff) ([]int64, erro | |||
// We try to reuse the old allocator, so the cached auto ID can be reused. | |||
var allocs autoid.Allocators | |||
if tableIDIsValid(oldTableID) { | |||
if oldTableID == newTableID && diff.Type != model.ActionRenameTable && diff.Type != model.ActionRebaseAutoID && diff.Type != model.ActionModifyTableAutoIdCache { | |||
if oldTableID == newTableID && diff.Type != model.ActionRenameTable && diff.Type != model.ActionRebaseAutoID && diff.Type != model.ActionRebaseAutoRandomBase && diff.Type != model.ActionModifyTableAutoIdCache { |
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 if we only rebase auto_random
, but auto_id
also rebase(we will clean the cache in TiDB).
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.
seems right. should keep the special allocator survive?
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.
Could we handle it?I think it feels confusing to users. And please add some tests.
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.
yes, Addressed
/run-integration-copr-test |
/run-integration-common-test |
1 similar comment
/run-integration-common-test |
/run-integration-common-test |
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
/run-all-tests |
@AilinKid merge failed. |
/run-integration-common-test |
integration-common-test seems nothing to do with this PR, so we gonna merge it now |
cherry pick to release-3.1 in PR #16812 |
cherry pick to release-4.0 in PR #16813 |
Signed-off-by: sre-bot <[email protected]>
What problem does this PR solve?
Problem Summary: support
auto_random_base
table option, this PR is related to issue pingcap/br#241What is changed and how it works?
How it Works:
After this table option:
We can do the auto_random rebase by
alter table xxx auto_random_base = num
Also we can specify the initial auto_random base by
create table t xxx(xxx) auto_random_base = num
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Release note
support auto_random table option for rebase auto_random allocator