-
Notifications
You must be signed in to change notification settings - Fork 725
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
pdctl: support config balance-leader
#4656
Conversation
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
@@ Coverage Diff @@
## master #4656 +/- ##
==========================================
- Coverage 75.09% 75.03% -0.06%
==========================================
Files 284 284
Lines 28022 28038 +16
==========================================
- Hits 21043 21039 -4
- Misses 5113 5129 +16
- Partials 1866 1870 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -442,10 +442,31 @@ func NewConfigSchedulerCommand() *cobra.Command { | |||
newConfigHotRegionCommand(), | |||
newConfigShuffleRegionCommand(), | |||
newConfigGrantHotRegionCommand(), | |||
newConfigBalanceLeaderCommand(), |
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.
How about other scheduler.
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.
How about other scheduler.
other schedulers should modify their config handler firstly
) | ||
return c | ||
} | ||
|
||
func newConfigBalanceLeaderCommand() *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.
The function is similar with newConfigHotRegionCommand
, maybe exract same code.
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 function is similar with
newConfigHotRegionCommand
, maybe exract same code.
maybe I can abstract out a function for all schedulers
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.
Currently, each scheduler has a different config API. It is possible to refactor it in the future, so I think just implement it simply now.
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
server/schedulers/balance_leader.go
Outdated
Ranges []core.KeyRange `json:"ranges"` | ||
Batch int `json:"batch"` | ||
} | ||
|
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.
add some annotation.
server/schedulers/balance_leader.go
Outdated
} | ||
|
||
func (handler *balanceLeaderHandler) UpdateConfig(w http.ResponseWriter, r *http.Request) { | ||
data, _ := io.ReadAll(r.Body) |
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.
why ignor this error.
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.
http.Request.Body only has EOF error. if EOF , it means data is nil, and it will be handled in line 97
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
|
||
c.AddCommand(&cobra.Command{ | ||
Use: "show", | ||
Short: "list the config item", |
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.
Short: "list the config item", | |
Short: "show the config item", |
pkg/apiutil/apiutil.go
Outdated
@@ -213,26 +213,37 @@ func NewAccessPath(path, method string) AccessPath { | |||
return AccessPath{Path: path, Method: method} | |||
} | |||
|
|||
type CheckOption func([]byte, int) |
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.
where is it used?
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
server/schedulers/balance_leader.go
Outdated
@@ -113,12 +116,13 @@ func (conf *balanceLeaderSchedulerConfig) Update(data []byte) (int, interface{}) | |||
return http.StatusBadRequest, "config item not found" | |||
} | |||
|
|||
func (conf *balanceLeaderSchedulerConfig) Adjust() { | |||
func (conf *balanceLeaderSchedulerConfig) Validate() bool { | |||
if conf.Batch < 1 { |
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.
use ||
server/schedulers/balance_leader.go
Outdated
@@ -113,12 +116,13 @@ func (conf *balanceLeaderSchedulerConfig) Update(data []byte) (int, interface{}) | |||
return http.StatusBadRequest, "config item not found" | |||
} | |||
|
|||
func (conf *balanceLeaderSchedulerConfig) Adjust() { | |||
func (conf *balanceLeaderSchedulerConfig) Validate() bool { |
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.
func (conf *balanceLeaderSchedulerConfig) Validate() bool { | |
func (conf *balanceLeaderSchedulerConfig) validate() bool { |
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
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
/merge |
@rleungx: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 4c08c71
|
Signed-off-by: Cabinfever_B cabinfeveroier@gmail.com
What problem does this PR solve?
Issue Number: ref #4610
This PR should be merged after #4652 #4655
What is changed and how it works?
Check List
Tests
Code changes
Related changes
pingcap/docs
/pingcap/docs-cn
:Release note