-
Notifications
You must be signed in to change notification settings - Fork 720
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
region: Add accelerate regions schedule API #2599
Conversation
server/api/region.go
Outdated
// @Success 200 {object} string | ||
// @Failure 400 {string} string "The input is invalid." | ||
// @Router /regions/keys/promote [get] | ||
func (h *regionsHandler) PromoteRegionsInRange(w http.ResponseWriter, r *http.Request) { |
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 think promote
is kind ambiguous, especially we already use the term for the meaning of promote a learner peer to voter.
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.
Could it be better to accept hex formatted keys?
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.
@disksing It's ok to me to change the API/function name here and do you know the API examples in the repo to know about the better format to accept hex formatted keys?
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 think maybe you can refer to parseKey
in region_command.go
?
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.
@disksing Do you think we need to add a format
parameter and support multi key formats here?
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.
IMO, hex format is enough because it is our preferred format in the future. Of course, supporting more formats won't make it worse.
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.
Thanks for clarifying.
84a27db
to
15e4618
Compare
/run-all-tests |
0f7626c
to
9e368d1
Compare
9e368d1
to
0d48d93
Compare
I think #2524 wants to solve a similar problem. Maybe we can find a common way to do it? |
IMO not very alike. |
Basically LGTM. But I wonder if we need to support a large number of regions in the range. One optimization method is to directly save the range, and then scan the range with higher priority first when scanning. |
server/api/region.go
Outdated
return | ||
} | ||
|
||
limit := defaultRegionLimit |
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.
16 seems to small
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.
@disksing Do you have any advice? What about 256?
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.
Sounds good to me
server/api/router.go
Outdated
@@ -148,6 +148,7 @@ func createRouter(ctx context.Context, prefix string, svr *server.Server) *mux.R | |||
clusterRouter.HandleFunc("/regions/check/hist-size", regionsHandler.GetSizeHistogram).Methods("GET") | |||
clusterRouter.HandleFunc("/regions/check/hist-keys", regionsHandler.GetKeysHistogram).Methods("GET") | |||
clusterRouter.HandleFunc("/regions/sibling/{id}", regionsHandler.GetRegionSiblings).Methods("GET") | |||
clusterRouter.HandleFunc("/regions/keys/accelerate-schedule", regionsHandler.AccelerateRegionsScheduleInRange).Methods("POST") |
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.
could regions/accelerate-schedule
be bettter?
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.
updated.
8470ec4
to
ff05a45
Compare
for _, region := range regions { | ||
regionsIDList = append(regionsIDList, region.GetID()) | ||
} | ||
rc.AddSuspectRegions(regionsIDList...) |
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.
What will happen if repeatedly adding the same regions?
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 duplicated operators would be discarded due to checkAddOperator (due to same priority)
in AddWaitingOperator
if the operators added in the first time haven't been successes yet. Is that true? @disksing
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 think true.
f75fe35
to
25193c3
Compare
/run-test |
/run-all-test |
/merge |
Sorry @lhy1024, you don't have permission to trigger auto merge event on this branch. The number of |
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.
LGTM
/merge |
Sorry @lhy1024, you don't have permission to trigger auto merge event on this branch. The number of |
LGTM |
@lhy1024,Thanks for your review. |
/merge |
Sorry @lhy1024, you don't have permission to trigger auto merge event on this branch. The number of |
LGTM |
@rleungx,Thanks for your review. |
Sorry @Yisaer, you don't have permission to trigger auto merge event on this branch. You are not a committer or co-leader or leader for the related sigs:scheduling(slack). |
/merge |
/run-all-tests |
@Yisaer merge failed. |
/run-integration-ddl-test |
/run-cherry-picker |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #2687 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com> Co-authored-by: Song Gao <disxiaofei@163.com>
Add one new region HTTP API.
What problem does this PR solve?
close #2593
What is changed and how it works?
Add one new region related http api to accelerate regions schedule by given key range.
Check List
Tests
Related changes
Release note