-
Notifications
You must be signed in to change notification settings - Fork 728
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
api: add a new scheduler to balance the regions of the given key range #8988
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: 童剑 <[email protected]>
Signed-off-by: 童剑 <[email protected]>
Skipping CI for Draft Pull Request. |
Signed-off-by: 童剑 <[email protected]>
Signed-off-by: 童剑 <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8988 +/- ##
==========================================
+ Coverage 74.91% 76.32% +1.40%
==========================================
Files 416 466 +50
Lines 42103 70740 +28637
==========================================
+ Hits 31543 53994 +22451
- Misses 7810 13391 +5581
- Partials 2750 3355 +605
Flags with carried forward coverage won't be shown. Click here to find out more. |
fe71a54
to
cb8a4b9
Compare
Signed-off-by: 童剑 <[email protected]>
cb8a4b9
to
d0cfc2d
Compare
type balanceKeyRangeSchedulerConfig struct { | ||
syncutil.RWMutex | ||
schedulerConfig | ||
balanceKeyRangeSchedulerParam |
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.
Shall we use a slice to support multiple key ranges with different roles or engines?
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.
We need to support a multi-key range with same role and engine.
Signed-off-by: 童剑 <[email protected]>
@@ -374,6 +375,17 @@ func NewBalanceWitnessSchedulerCommand() *cobra.Command { | |||
return c | |||
} | |||
|
|||
// NewBalanceRangeSchedulerCommand returns a command to add a balance-key-range-scheduler. | |||
func NewBalanceRangeSchedulerCommand() *cobra.Command { |
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.
Do we need to support it? It's hard to use.
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.
yes, it's helpful to debug it in the first step, and then it recommends the SQL function description
Signed-off-by: 童剑 <[email protected]>
0bb25b9
to
8bdb7bc
Compare
Role string `json:"role"` | ||
Engine string `json:"engine"` | ||
Timeout time.Duration `json:"timeout"` | ||
Ranges []core.KeyRange `json:"ranges"` |
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.
I wonder if we can let the API interface like:
type KeyRange strut {
Alias string `json:"alias"`
KeyRange string `json:"range"`
}
Then we can alias the table name by tidb or others to help the user read it.
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.
the key range may be some partition of one table, and we can decode this key by ctl.
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.
The readability is too poor.
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.
understand, I will add one property to record the table name.
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
Signed-off-by: 童剑 <[email protected]>
eabfb27
to
0696ba6
Compare
Signed-off-by: 童剑 <[email protected]>
Engine string `json:"engine"` | ||
Timeout time.Duration `json:"timeout"` | ||
Ranges []core.KeyRange `json:"ranges"` | ||
TableName string `json:"table-name"` |
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.
Name it as alias
for better, since pd does not understand the table concept.
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.
The rest LGTM except the left comment.
Use: "balance-range-scheduler [--format=raw|encode|hex] <engine> <role> <table-name> <start_key> <end_key>", | ||
Short: "add a scheduler to balance region for given range", | ||
Run: addSchedulerForBalanceRangeCommandFunc, | ||
Deprecated: "balance-range will be deprecated in the future, please use sql instead", |
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.
It's strange to add Deprecated
now.
[LGTM Timeline notifier]Timeline:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rleungx The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: Close #8987
What is changed and how does it work?
Check List
Tests
Code changes
Side effects
Related changes
Release note