-
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
Changes from 1 commit
e693b3e
23ff7d0
1e6d628
d1da5b5
d0cfc2d
d86148f
8bdb7bc
0696ba6
5d5ee0f
225184c
39ec9b2
e509705
439f692
33c12bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: 童剑 <1045931706@qq.com>
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -378,7 +378,7 @@ func NewBalanceWitnessSchedulerCommand() *cobra.Command { | |
// NewBalanceRangeSchedulerCommand returns a command to add a balance-range-scheduler. | ||
func NewBalanceRangeSchedulerCommand() *cobra.Command { | ||
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. Do we need to support it? It's hard to use. 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. yes, it's helpful to debug it in the first step, and then it recommends the SQL function description 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. How about using API to test now? I don't think we need to add a new command that's going to be deprecated soon. |
||
c := &cobra.Command{ | ||
Use: "balance-range-scheduler [--format=raw|encode|hex] <engine> <role> <start_key> <end_key>", | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. It's strange to add 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. removed and add one todo for sql implement |
||
|
@@ -426,16 +426,16 @@ func addSchedulerForGrantHotRegionCommandFunc(cmd *cobra.Command, args []string) | |
} | ||
|
||
func addSchedulerForBalanceRangeCommandFunc(cmd *cobra.Command, args []string) { | ||
if len(args) != 4 { | ||
if len(args) != 5 { | ||
cmd.Println(cmd.UsageString()) | ||
return | ||
} | ||
startKey, err := parseKey(cmd.Flags(), args[2]) | ||
startKey, err := parseKey(cmd.Flags(), args[3]) | ||
if err != nil { | ||
cmd.Println("Error: ", err) | ||
return | ||
} | ||
endKey, err := parseKey(cmd.Flags(), args[3]) | ||
endKey, err := parseKey(cmd.Flags(), args[4]) | ||
if err != nil { | ||
cmd.Println("Error: ", err) | ||
return | ||
|
@@ -445,8 +445,9 @@ func addSchedulerForBalanceRangeCommandFunc(cmd *cobra.Command, args []string) { | |
input["name"] = cmd.Name() | ||
input["engine"] = args[0] | ||
input["role"] = args[1] | ||
input["start_key"] = url.QueryEscape(startKey) | ||
input["end_key"] = url.QueryEscape(endKey) | ||
input["table-name"] = args[2] | ||
input["start-key"] = url.QueryEscape(startKey) | ||
input["end-key"] = url.QueryEscape(endKey) | ||
|
||
postJSON(cmd, schedulersPrefix, input) | ||
} | ||
|
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.
cc @bufferflies
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