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

*: add table option: wait_split_finish #293

Closed
wants to merge 2 commits into from

Conversation

crazycs520
Copy link
Contributor

What problem does this PR solve?

Add a table option wait_split_finish.
This is for PR pingcap/tidb#10138.
wait_split_finish means wait pre-split and scatter finish before return client.

What is changed and how it works?

Check List

Tests

  • Unit test

Code changes

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@morgo
Copy link
Contributor

morgo commented Apr 20, 2019

I read pingcap/tidb#10138 - I am curious why don't we pre-split regions by default synchronously, is it for backward compatibility or the use case that a user needs to create a lot of tables?

It becomes hard for usability if there are three options the user needs to remember:

  • shard-id-bits
  • pre-split-regions
  • wait-split-finish

I like the names you have chosen though, they make sense to me.

@crazycs520
Copy link
Contributor Author

@morgo , Because scatter region maybe spend a lot of time,in my local test, I have 1 TiDB, 1 PD, 3 TiKV, then pre-split 8 regions will spend 30 ~ 75s, so we hope client can control this.

There are 3 options, but you can only use the related options that you need.

@@ -218,6 +218,9 @@ type TableInfo struct {
// The pre-split region num is 2^(PreSplitRegions-1).
// And the PreSplitRegions should less than or equal to ShardRowIDBits.
PreSplitRegions uint64 `json:"pre_split_regions"`
// WaitSplitFinish specify the pre-split region to do with synchronous or asynchronous.
// false means pre-split region with asynchronous.
WaitSplitFinish bool `json:"wait_split_finish"`
Copy link
Contributor

Choose a reason for hiding this comment

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

We can put this option as a session variable, it is weird to be a table option. And we should not add this field in the tableInfo.

Copy link
Contributor Author

@crazycs520 crazycs520 Apr 24, 2019

Choose a reason for hiding this comment

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

ok, I will use session variable to control this

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for session var

@crazycs520 crazycs520 closed this Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants