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

schedule: combine store limit and store balance rate #2437

Merged
merged 8 commits into from
Jun 18, 2020

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented May 21, 2020

What problem does this PR solve?

Close #2245.

What is changed and how it works?

This PR mainly does these things:

  • remove store-balance-rate
  • persist store limit in schedule config
  • change the auto store limit policy
  • rename *region to *peer
  • move RemoveScheduler from Options to Cluster interface
  • some updates for testing and doc.

Check List

Tests

  • Unit test

Release note

  • No release note

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2020

Codecov Report

Merging #2437 into master will increase coverage by 0.37%.
The diff coverage is 84.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2437      +/-   ##
==========================================
+ Coverage   77.06%   77.43%   +0.37%     
==========================================
  Files         204      204              
  Lines       22079    22121      +42     
==========================================
+ Hits        17015    17130     +115     
+ Misses       3773     3714      -59     
+ Partials     1291     1277      -14     
Impacted Files Coverage Δ
server/statistics/store_collection.go 59.70% <ø> (+0.44%) ⬆️
server/cluster/store_limiter.go 53.70% <46.15%> (ø)
server/api/store.go 65.50% <60.00%> (+0.15%) ⬆️
pkg/mock/mockoption/mockoption.go 90.76% <79.48%> (-4.98%) ⬇️
server/schedule/operator_controller.go 79.27% <83.33%> (+0.61%) ⬆️
server/config/persist_options.go 89.77% <86.95%> (-0.69%) ⬇️
server/schedule/storelimit/store_limit.go 84.00% <88.88%> (+8.24%) ⬆️
server/handler.go 53.20% <90.62%> (+1.59%) ⬆️
server/cluster/cluster.go 80.65% <92.00%> (+0.71%) ⬆️
pkg/mock/mockcluster/mockcluster.go 91.75% <100.00%> (+0.18%) ⬆️
... and 28 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 0df431e...6dd271c. Read the comment docs.

tools/pd-ctl/pdctl/command/config_command.go Show resolved Hide resolved
@@ -148,7 +148,6 @@ func (s *storeStatistics) Collect() {
configs["high-space-ratio"] = s.opt.GetHighSpaceRatio()
configs["low-space-ratio"] = s.opt.GetLowSpaceRatio()
configs["tolerant-size-ratio"] = s.opt.GetTolerantSizeRatio()
configs["store-balance-rate"] = s.opt.GetStoreBalanceRate()
Copy link
Contributor

Choose a reason for hiding this comment

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

when users try to set this config, will we show that it has been expired?

Copy link
Member Author

Choose a reason for hiding this comment

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

It will show the message now.

@@ -539,6 +546,11 @@ func (mc *Cluster) GetMaxReplicas() int {
return mc.ScheduleOptions.GetMaxReplicas()
}

// GetStoreLimitByType mocks method.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to emphasize ByType?

Copy link
Member Author

Choose a reason for hiding this comment

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

what do you mean "emphasize ByType"?

Copy link
Contributor

Choose a reason for hiding this comment

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

how about replacing with GetStoreLimit

Copy link
Member Author

Choose a reason for hiding this comment

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

I think both GetStoreLimit and GetStoreLimitByType are ok here.

server/api/store.go Outdated Show resolved Hide resolved
server/schedule/operator_controller_test.go Outdated Show resolved Hide resolved
server/handler.go Outdated Show resolved Hide resolved
server/cluster/cluster.go Show resolved Hide resolved
@nolouch nolouch added the component/schedule Scheduling logic. label Jun 11, 2020
server/config/config.go Show resolved Hide resolved
tools/pd-ctl/README.md Show resolved Hide resolved
@rleungx
Copy link
Member Author

rleungx commented Jun 17, 2020

/run-all-tests

1 similar comment
@rleungx
Copy link
Member Author

rleungx commented Jun 17, 2020

/run-all-tests

@nolouch nolouch added the needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. label Jun 17, 2020
Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

rest LGTM..

server/config/config.go Show resolved Hide resolved
>> store limit region-remove // Show limits of removing region operation for all stores
>> store limit // Show limits of adding peer operation for all stores
>> store limit add-peer // Show limits of adding peer operation for all stores
>> store limit remove-peer // Show limits of removing peer operation for all stores
>> store limit all 5 // Limit 5 adding region operations per minute for all stores
Copy link
Contributor

Choose a reason for hiding this comment

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

store limit all 5

the command only set for add-peer, can we set remove-peer at the same time?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure it's better. What is your opinion? @lhy1024

Copy link
Contributor

@nolouch nolouch Jun 18, 2020

Choose a reason for hiding this comment

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

Before, the user only needed one command. Now users think that the speed has been increased, but in fact there is still a speed limit for remove-peer.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx
Copy link
Member Author

rleungx commented Jun 18, 2020

@lhy1024 @nolouch PTAL

Signed-off-by: Ryan Leung <rleungx@gmail.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

c, err := h.GetOperatorController()
if err != nil {
return err
func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Type) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I found there is a lot of code about set storelimit, I don’t know if they can be simplified

@nolouch
Copy link
Contributor

nolouch commented Jun 18, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 18, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit 444498e into tikv:master Jun 18, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 failed

rleungx added a commit to rleungx/pd that referenced this pull request Jun 19, 2020
Signed-off-by: Ryan Leung <rleungx@gmail.com>
ti-srebot pushed a commit that referenced this pull request Jun 19, 2020
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/schedule Scheduling logic. needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UCP: Combine the store balance rate and store limit
5 participants