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: allow empty region to be scheduled and use a sperate tolerance config in scatter range scheduler (#4106) #4117

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #4106

What problem does this PR solve?

  1. we expect the tolerance ratio in range cluster should be 2, but it doesn't take effect.

    c.SetTolerantSizeRatio(2)

    tolerantSizeRatio := cluster.GetOpts().GetTolerantSizeRatio()

  2. we expect it can schedule empty region, but it can not and test can not detect

    EmptyRegionApproximateSize = 1

    // empty case
    regions[49].EndKey = []byte("")
    for _, meta := range regions {
    leader := rand.Intn(4) % 3
    regionInfo := core.NewRegionInfo(
    meta,
    meta.Peers[leader],
    core.SetApproximateKeys(96),
    core.SetApproximateSize(96),

What is changed and how it works?

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

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

Add scatter range scheduler

Before this pr
image
After this pr
image

Related changes

  • Need to cherry-pick to the release branch

Release note

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

@ti-chi-bot
Copy link
Member Author

ti-chi-bot commented Sep 13, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • disksing
  • nolouch

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 the status/LGT1 Indicates that a PR has LGTM 1. label Sep 14, 2021
@zhouqiang-cl zhouqiang-cl added the cherry-pick-approved Cherry pick PR approved by release team. label Sep 14, 2021
server/schedulers/utils.go Outdated Show resolved Hide resolved
disksing and others added 2 commits September 14, 2021 15:36
* 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]>
…ance config in scatter range scheduler (tikv#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]>
@lhy1024 lhy1024 force-pushed the cherry-pick-4106-to-release-5.1 branch from dd428f2 to ff080cc Compare September 14, 2021 07:37
@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 Sep 14, 2021
@nolouch
Copy link
Contributor

nolouch commented Sep 14, 2021

/merge

@ti-chi-bot
Copy link
Member Author

@nolouch: 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 Author

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

Commit hash: ff080cc

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 14, 2021
@codecov
Copy link

codecov bot commented Sep 14, 2021

Codecov Report

Merging #4117 (e33ff01) into release-5.1 (edfecb9) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release-5.1    #4117      +/-   ##
===============================================
+ Coverage        75.23%   75.30%   +0.06%     
===============================================
  Files              245      245              
  Lines            24646    24657      +11     
===============================================
+ Hits             18543    18567      +24     
+ Misses            4489     4479      -10     
+ Partials          1614     1611       -3     
Flag Coverage Δ
unittests 75.30% <100.00%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
server/schedulers/balance_region.go 89.07% <100.00%> (+0.58%) ⬆️
server/schedulers/utils.go 94.14% <100.00%> (+0.14%) ⬆️
server/election/leadership.go 85.88% <0.00%> (-3.53%) ⬇️
server/schedulers/random_merge.go 60.65% <0.00%> (-3.28%) ⬇️
client/base_client.go 82.47% <0.00%> (-2.07%) ⬇️
server/tso/tso.go 71.91% <0.00%> (-1.13%) ⬇️
pkg/btree/btree.go 85.30% <0.00%> (-0.97%) ⬇️
server/server.go 71.58% <0.00%> (-0.61%) ⬇️
server/grpc_service.go 48.34% <0.00%> (-0.46%) ⬇️
server/tso/allocator_manager.go 80.30% <0.00%> (+0.16%) ⬆️
... and 8 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 edfecb9...e33ff01. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. component/scheduler Scheduler logic. release-note Denotes a PR that will be considered when it comes time to generate release notes. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick-for-release-5.1 The PR belongs to release-5.1 cherry pick.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants