-
Notifications
You must be signed in to change notification settings - Fork 6k
ddl: let partition table pre split index regions #59547
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
99ed646
ddl: let partition table pre split index regions
Defined2014 9c6d9ce
update
Defined2014 b66ace6
make format
Defined2014 1cd34ca
update
Defined2014 7e52e0a
update
Defined2014 b752bb2
update
Defined2014 c68b872
update
Defined2014 e635516
update
Defined2014 73d65f7
update
Defined2014 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -575,6 +575,29 @@ func TestShowTableRegion(t *testing.T) { | |
} | ||
require.Equal(t, infosync.PlacementScheduleStatePending.String(), rows[i][12]) | ||
} | ||
|
||
tk.MustExec("drop table if exists sbtest0000") | ||
tk.MustExec("CREATE TABLE sbtest0000(" + | ||
" id bigint," + | ||
" k bigint DEFAULT '0' NOT NULL," + | ||
" c CHAR(120) DEFAULT '' NOT NULL," + | ||
" pad CHAR(60) DEFAULT '' NOT NULL," + | ||
" UNIQUE KEY uk(id) GLOBAL," + | ||
" key idx0(k,c)," + | ||
" key idx1(c))SHARD_ROW_ID_BITS=3 PRE_SPLIT_REGIONS=2 " + | ||
"PARTITION BY RANGE(id)(PARTITION p VALUES LESS THAN (MAXVALUE))") | ||
re = tk.MustQuery("show table sbtest0000 regions") | ||
rows = re.Rows() | ||
require.Len(t, rows, 7) // 3 index regions + 4 record regions | ||
|
||
tbl = external.GetTableByName(t, tk, "test", "sbtest0000") | ||
require.Equal(t, fmt.Sprintf("t_%d_i_1_", tbl.Meta().ID), rows[0][1]) // index `uk`` | ||
require.Equal(t, fmt.Sprintf("t_%d_i_4_", tbl.Meta().ID+1), rows[1][1]) | ||
require.Regexp(t, fmt.Sprintf("t_%d_r_.*", tbl.Meta().ID+1), rows[2][1]) | ||
require.Regexp(t, fmt.Sprintf("t_%d_r_.*", tbl.Meta().ID+1), rows[3][1]) | ||
require.Regexp(t, fmt.Sprintf("t_%d_r_.*", tbl.Meta().ID+1), rows[4][1]) | ||
require.Equal(t, fmt.Sprintf("t_%d_", tbl.Meta().ID+1), rows[5][1]) // index `idx0` | ||
require.Equal(t, fmt.Sprintf("t_%d_i_3_", tbl.Meta().ID+1), rows[6][1]) // index `idx1` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
func BenchmarkLocateRegion(t *testing.B) { | ||
|
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.
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.
Is it for the global index? Could we add a comment for it?
Besides, do we need to update the capacity for
regionIDs
?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.
Done