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) #16286

Closed

Conversation

sre-bot
Copy link
Contributor

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

cherry-pick #15409 to release-2.1


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.

Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 10, 2020

/run-all-tests

@@ -271,7 +271,11 @@ func convertJob2RollbackJob(w *worker, d *ddlCtx, t *meta.Meta, job *model.Job)
model.ActionModifyColumn, model.ActionAddForeignKey,
model.ActionDropForeignKey, model.ActionRenameTable,
model.ActionModifyTableCharsetAndCollate, model.ActionTruncateTablePartition,
<<<<<<< HEAD
model.ActionModifySchemaCharsetAndCollate:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix the conflicts.
@AilinKid

@AilinKid
Copy link
Contributor

blocked by some PR cherry-pick in Parser

@AilinKid
Copy link
Contributor

This 2.1 cherry-pick need some previous work cherry-picked first, I will follow it

@AilinKid
Copy link
Contributor

AilinKid commented Sep 3, 2020

Closed because this feature is designed for release 3.0 +

@AilinKid AilinKid closed this Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants