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

schedulers: avoid recalculate tolerantRatio #3745

Merged
merged 3 commits into from
Jun 7, 2021

Conversation

disksing
Copy link
Contributor

@disksing disksing commented Jun 4, 2021

Signed-off-by: disksing [email protected]

What problem does this PR solve?

Improve GetStoreRegionCount
Part of #3744

What is changed and how it works?

Calculate tolerantSizeRatio when the balancePlan is created and reuse it later.

Check List

Tests

  • Unit test

Release note

None

@disksing disksing added the type/enhancement The issue or PR belongs to an enhancement. label Jun 4, 2021
@ti-chi-bot ti-chi-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jun 4, 2021
@ti-chi-bot ti-chi-bot requested review from lhy1024 and rleungx June 4, 2021 05:49
Comment on lines 126 to +130
regionSize := p.region.GetApproximateSize()
if regionSize < p.cluster.GetAverageRegionSize() {
regionSize = p.cluster.GetAverageRegionSize()
}
regionSize = int64(float64(regionSize) * adjustTolerantRatio(p.cluster))
return regionSize
return int64(float64(regionSize) * p.tolerantSizeRatio)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move them to adjustTolerantRatio

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The regionSize is related to the region which is selected to balance so it cannot be calculated ahead.

Signed-off-by: disksing <[email protected]>
@codecov
Copy link

codecov bot commented Jun 4, 2021

Codecov Report

Merging #3745 (4778740) into master (b5909a7) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3745      +/-   ##
==========================================
- Coverage   75.08%   75.01%   -0.08%     
==========================================
  Files         244      244              
  Lines       24504    24504              
==========================================
- Hits        18400    18381      -19     
- Misses       4481     4494      +13     
- Partials     1623     1629       +6     
Flag Coverage Δ
unittests 75.01% <100.00%> (-0.08%) ⬇️

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

Impacted Files Coverage Δ
server/schedulers/utils.go 93.75% <100.00%> (ø)
server/region_syncer/client.go 78.19% <0.00%> (-4.52%) ⬇️
server/member/member.go 65.59% <0.00%> (-3.23%) ⬇️
server/tso/allocator_manager.go 77.12% <0.00%> (-2.01%) ⬇️
server/schedule/operator/step.go 67.44% <0.00%> (-1.67%) ⬇️
server/server.go 72.07% <0.00%> (-0.92%) ⬇️
server/grpc_service.go 47.32% <0.00%> (-0.80%) ⬇️
server/core/storage.go 67.68% <0.00%> (-0.77%) ⬇️
server/cluster/cluster.go 82.84% <0.00%> (-0.24%) ⬇️
pkg/tempurl/tempurl.go 60.00% <0.00%> (ø)
... and 7 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 b5909a7...4778740. Read the comment docs.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 7, 2021
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.

lgtm

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • nolouch
  • 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 Jun 7, 2021
@disksing
Copy link
Contributor Author

disksing commented Jun 7, 2021

/merge

@ti-chi-bot
Copy link
Member

@disksing: 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: 92ef0b3

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 7, 2021
@disksing
Copy link
Contributor Author

disksing commented Jun 7, 2021

/run-integration-common-test

@ti-chi-bot ti-chi-bot merged commit 6c52d75 into tikv:master Jun 7, 2021
@disksing disksing deleted the tolerant-ratio2 branch June 7, 2021 09:18
bufferflies pushed a commit to bufferflies/pd that referenced this pull request Jul 9, 2021
* schedulers: avoid recalculate tolerantRatio

Signed-off-by: disksing <[email protected]>

* fix test

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
bufferflies pushed a commit to bufferflies/pd that referenced this pull request Jul 9, 2021
* schedulers: avoid recalculate tolerantRatio

Signed-off-by: disksing <[email protected]>

* fix test

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
HunDunDM pushed a commit to HunDunDM/pd that referenced this pull request Aug 19, 2021
* schedulers: avoid recalculate tolerantRatio

Signed-off-by: disksing <[email protected]>

* fix test

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
lhy1024 pushed a commit to ti-chi-bot/pd that referenced this pull request Sep 14, 2021
* schedulers: avoid recalculate tolerantRatio

Signed-off-by: disksing <[email protected]>

* fix test

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
ti-chi-bot added a commit that referenced this pull request Sep 14, 2021
…ance config in scatter range scheduler (#4106) (#4117)

* schedulers: avoid recalculate tolerantRatio (#3745)

* schedulers: avoid recalculate tolerantRatio

Signed-off-by: disksing <[email protected]>

* fix test

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>

* scheduler: allow empty region to be scheduled and use a sperate tolerance config in scatter range scheduler (#4106)

* scheduler: allow empty region to be scheduled and use a sperate tolerance config in scatter range scheduler

Signed-off-by: lhy1024 <[email protected]>

* fix lint

Signed-off-by: lhy1024 <[email protected]>

* address comments

Signed-off-by: lhy1024 <[email protected]>

* fix lint

Signed-off-by: lhy1024 <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>

Co-authored-by: disksing <[email protected]>
Co-authored-by: lhy1024 <[email protected]>
HunDunDM pushed a commit that referenced this pull request Sep 27, 2021
* schedulers: avoid recalculate tolerantRatio

Signed-off-by: disksing <[email protected]>

* fix test

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
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. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants