Skip to content
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: add syntax for setting the cache step of auto id explicitly. (#15409) #16289

Merged
merged 2 commits into from
Apr 11, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Apr 10, 2020

cherry-pick #15409 to release-4.0


What problem does this PR solve?

That autoid allocator's cache step is quite big now, it will consume a lot of autoid when tidb restarts or crashes. For those scenes which treasure autoid heavily, it's not acceptable.

Parser link: #765

Problem Summary:

What is changed and how it works?

Add auto_increment_cache in create table / alter table statement and it will determine the allocator's cache step.

But there is an exception when a statement like an insert batch(insert into values()()...) which requires allocating consecutive N autoid in one statement, we will make sure that the custom cache step is adequate for it with if step < N, then step = min(2N, maxstep)

Attention please:
tidb handle share the same allocator with auto_increment, so here:
auto_increment_cache will take effect on handle if PKIshandle is false, or even there is no auto_increment column at all.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • PR to update pingcap/tidb-ansible:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Release note:

ddl: add syntax for setting the cache step of auto id explicitly.

@sre-bot sre-bot requested a review from a team as a code owner April 10, 2020 08:02
@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 10, 2020

/run-all-tests

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zimulala zimulala added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 10, 2020
Copy link
Contributor

@Deardrops Deardrops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 11, 2020
@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 11, 2020

Your auto merge job has been accepted, waiting for 16181

@zz-jason zz-jason merged commit 0f9d5fb into pingcap:release-4.0 Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants