Skip to content
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

scheduler: support multi priorities api for hot-region-scheduler #3899

Merged
merged 12 commits into from
Jul 27, 2021

Conversation

Yisaer
Copy link
Contributor

@Yisaer Yisaer commented Jul 22, 2021

Signed-off-by: yisaer disxiaofei@163.com

What problem does this PR solve?

What is changed and how it works?

Support the api for priorities for balance-hot-region-scheduler

Check List

Tests

  • Unit test

Release note

None

Signed-off-by: yisaer <disxiaofei@163.com>
Signed-off-by: yisaer <disxiaofei@163.com>
@ti-chi-bot ti-chi-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jul 22, 2021
expected1["read-priorities"] = []interface{}{"key"}
mustExec([]string{"-u", pdAddr, "scheduler", "config", "balance-hot-region-scheduler"}, &conf1)
c.Assert(conf1, DeepEquals, expected1)
mustExec([]string{"-u", pdAddr, "scheduler", "config", "balance-hot-region-scheduler", "set", "read-priorities", "key,byte"}, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen to it if the string is empty or otherwise unparseable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Signed-off-by: yisaer <disxiaofei@163.com>
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #3899 (0133b1d) into master (9e15727) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3899      +/-   ##
==========================================
- Coverage   74.56%   74.49%   -0.08%     
==========================================
  Files         246      246              
  Lines       24868    24885      +17     
==========================================
- Hits        18543    18537       -6     
- Misses       4670     4687      +17     
- Partials     1655     1661       +6     
Flag Coverage Δ
unittests 74.49% <100.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/schedulers/hot_region_config.go 83.00% <100.00%> (+0.34%) ⬆️
tools/pd-ctl/pdctl/command/scheduler.go 72.86% <100.00%> (+1.93%) ⬆️
server/tso/local_allocator.go 71.62% <0.00%> (-6.76%) ⬇️
server/region_syncer/server.go 83.33% <0.00%> (-6.07%) ⬇️
server/region_syncer/client.go 78.19% <0.00%> (-4.52%) ⬇️
server/election/leadership.go 83.90% <0.00%> (-3.45%) ⬇️
server/schedule/operator/step.go 67.44% <0.00%> (-1.67%) ⬇️
server/tso/allocator_manager.go 68.11% <0.00%> (-1.34%) ⬇️
server/core/storage.go 67.68% <0.00%> (-0.77%) ⬇️
server/cluster/coordinator.go 73.42% <0.00%> (-0.70%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e15727...0133b1d. Read the comment docs.

Signed-off-by: yisaer <disxiaofei@163.com>
Signed-off-by: yisaer <disxiaofei@163.com>
Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rest LGTM

@@ -30,6 +30,15 @@ import (
"github.com/unrolled/render"
)

const (
// NonePriority indicates there is no dim priority for hot-region-scheduler
NonePriority = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it might be disturbing for users to think that None means no priority, meaning that each dimension has the same priority

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our current implement already has priority, it looks:

read-priorities [key, byte]
write-priorities [btye, key]

am I right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

@@ -269,6 +269,8 @@ func (s *schedulerTestSuite) TestScheduler(c *C) {
"minor-dec-ratio": 0.99,
"src-tolerance-ratio": 1.05,
"dst-tolerance-ratio": 1.05,
"read-priorities": []interface{}{},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, we can use a default priority.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

Signed-off-by: yisaer <disxiaofei@163.com>
@Yisaer Yisaer force-pushed the support_multy_priority_api branch from f4b136b to 807a828 Compare July 27, 2021 08:45
Signed-off-by: yisaer <disxiaofei@163.com>
Signed-off-by: yisaer <disxiaofei@163.com>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 27, 2021
priorities := make([]string, 0)
for _, priority := range strings.Split(value, ",") {
if priority != schedulers.BytePriority && priority != schedulers.KeyPriority {
cmd.Println(fmt.Sprintf("priority should be one of %s,%s,%s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need none anymore?

Signed-off-by: yisaer <disxiaofei@163.com>
Signed-off-by: yisaer <disxiaofei@163.com>
prioritiesMap := make(map[string]struct{}, 0)
for _, priority := range strings.Split(value, ",") {
if priority != schedulers.BytePriority && priority != schedulers.KeyPriority {
cmd.Println(fmt.Sprintf("priority should be one of %s,%s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

Suggested change
cmd.Println(fmt.Sprintf("priority should be one of %s,%s",
cmd.Println(fmt.Sprintf("priority should be one of [%s, %s]",

Copy link
Member

@rleungx rleungx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lhy1024
  • rleungx

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 27, 2021
Signed-off-by: yisaer <disxiaofei@163.com>
@Yisaer
Copy link
Contributor Author

Yisaer commented Jul 27, 2021

/merge

@ti-chi-bot
Copy link
Member

@Yisaer: 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.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: a0d9fd5

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 27, 2021
@ti-chi-bot ti-chi-bot merged commit 127df63 into tikv:master Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants