ddl: speed up the operation of "create table"#6861
Merged
coocood merged 9 commits intopingcap:masterfrom Jun 25, 2018
Merged
Conversation
Contributor
|
/run-all-tests |
alivxxx
reviewed
Jun 20, 2018
| } | ||
|
|
||
| func splitTableRegion(store kv.Storage, tableID int64) error { | ||
| type splitableStore interface { |
Contributor
Author
There was a problem hiding this comment.
I don't add it, I only move it from splitTableRegion to here.
Contributor
There was a problem hiding this comment.
But it still appears in splitTableRegion.
Member
There was a problem hiding this comment.
Should we remove the code at line 135~137?
shenli
reviewed
Jun 20, 2018
ddl/table.go
Outdated
| tableStartKey := tablecodec.GenTablePrefix(tableID) | ||
| if err := s.SplitRegion(tableStartKey); err != nil { | ||
| return errors.Trace(err) | ||
| // It will be automatically splitting by TiKV later. |
Contributor
Author
|
PTAL @lamxTyler @shenli |
Member
|
LGTM |
Member
|
@winkyao @lamxTyler PTAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What have you changed? (mandatory)
Handle table split operations asynchronously.
What are the type of the changes (mandatory)?
Does this PR affect documentation (docs/docs-cn) update? (optional)
No.
Benchmark result if necessary (optional)
Using TiKV
The test code as follows:
use the original code, the result as follows:
2018/05/18 17:37:16 tidb_create.go:35: [info] exec sql use db0
2018/05/18 17:41:09 tidb_create.go:44: [info] exec sqls take time 3m53.493631103s
2018/05/18 17:41:09 tidb_create.go:35: [info] exec sql use db1
2018/05/18 17:45:03 tidb_create.go:44: [info] exec sqls take time 3m53.914944715s
2018/05/18 17:45:03 tidb_create.go:35: [info] exec sql use db2
2018/05/18 17:48:57 tidb_create.go:44: [info] exec sqls take time 3m53.528751212s
2018/05/18 17:48:57 tidb_create.go:35: [info] exec sql use db3
2018/05/18 17:52:56 tidb_create.go:44: [info] exec sqls take time 3m59.223324563s
2018/05/18 17:52:56 tidb_create.go:35: [info] exec sql use db4
2018/05/18 17:56:56 tidb_create.go:44: [info] exec sqls take time 3m59.867498659s
2018/05/18 17:56:56 tidb_create.go:35: [info] exec sql use db5
2018/05/18 18:01:01 tidb_create.go:44: [info] exec sqls take time 4m5.327908179s
2018/05/18 18:01:01 tidb_create.go:35: [info] exec sql use db6
2018/05/18 18:05:09 tidb_create.go:44: [info] exec sqls take time 4m7.886515515s
2018/05/18 18:05:09 tidb_create.go:35: [info] exec sql use db7
2018/05/18 18:09:15 tidb_create.go:44: [info] exec sqls take time 4m5.60381973s
2018/05/18 18:09:15 tidb_create.go:35: [info] exec sql use db8
2018/05/18 18:13:32 tidb_create.go:44: [info] exec sqls take time 4m16.640030126s
use the new code, the result as follows:
2018/05/18 18:42:03 tidb_create.go:35: [info] exec sql use db0
2018/05/18 18:44:08 tidb_create.go:44: [info] exec sqls take time 2m4.89636175s
2018/05/18 18:44:08 tidb_create.go:35: [info] exec sql use db1
2018/05/18 18:46:14 tidb_create.go:44: [info] exec sqls take time 2m5.840172046s
2018/05/18 18:46:14 tidb_create.go:35: [info] exec sql use db2
2018/05/18 18:48:22 tidb_create.go:44: [info] exec sqls take time 2m7.847079946s
2018/05/18 18:48:22 tidb_create.go:35: [info] exec sql use db3
2018/05/18 18:50:32 tidb_create.go:44: [info] exec sqls take time 2m9.464254105s
2018/05/18 18:50:32 tidb_create.go:35: [info] exec sql use db4
2018/05/18 18:52:42 tidb_create.go:44: [info] exec sqls take time 2m10.56319663s
2018/05/18 18:52:43 tidb_create.go:35: [info] exec sql use db5
2018/05/18 18:54:57 tidb_create.go:44: [info] exec sqls take time 2m14.954220944s
2018/05/18 18:54:58 tidb_create.go:35: [info] exec sql use db6
2018/05/18 18:57:14 tidb_create.go:44: [info] exec sqls take time 2m16.526956612s
2018/05/18 18:57:14 tidb_create.go:35: [info] exec sql use db7
2018/05/18 18:59:33 tidb_create.go:44: [info] exec sqls take time 2m18.566134241s
2018/05/18 18:59:33 tidb_create.go:35: [info] exec sql use db8
2018/05/18 19:02:33 tidb_create.go:44: [info] exec sqls take time 3m0.43806444s