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

Merged
merged 5 commits into from Sep 13, 2021

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Sep 13, 2021

What problem does this PR solve?

close #4497

  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

@lhy1024 lhy1024 added component/scheduler Scheduler logic. needs-cherry-pick-release-5.0 The PR needs to cherry pick to release-5.0 branch. needs-cherry-pick-release-5.1 Type: Need cherry pick to release-5.1 needs-cherry-pick-release-5.2 Type: Need cherry pick to release-5.2 labels Sep 13, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 13, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • disksing
  • 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 release-note The PR should write the release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 13, 2021
@codecov
Copy link

codecov bot commented Sep 13, 2021

Codecov Report

Merging #4106 (dfb5701) into master (3f53f1e) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

❗ Current head dfb5701 differs from pull request most recent head 3cd0569. Consider uploading reports for the commit 3cd0569 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4106      +/-   ##
==========================================
- Coverage   74.53%   74.46%   -0.08%     
==========================================
  Files         258      258              
  Lines       26323    26334      +11     
==========================================
- Hits        19621    19609      -12     
- Misses       4963     4981      +18     
- Partials     1739     1744       +5     
Flag Coverage Δ
unittests 74.46% <100.00%> (-0.08%) ⬇️

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

Impacted Files Coverage Δ
server/core/kind.go 61.90% <ø> (ø)
server/schedule/opt/opts.go 100.00% <ø> (ø)
pkg/mock/mockcluster/mockcluster.go 95.23% <100.00%> (+0.01%) ⬆️
server/cluster/cluster.go 82.58% <100.00%> (+0.37%) ⬆️
server/schedule/opt/healthy.go 100.00% <100.00%> (ø)
server/schedule/range_cluster.go 90.90% <100.00%> (+3.87%) ⬆️
server/schedulers/scatter_range.go 80.79% <100.00%> (ø)
server/schedulers/utils.go 94.75% <100.00%> (+0.07%) ⬆️
server/election/lease.go 84.12% <0.00%> (-4.77%) ⬇️
pkg/etcdutil/etcdutil.go 84.70% <0.00%> (-3.53%) ⬇️
... and 16 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 3f53f1e...3cd0569. Read the comment docs.

…ance config in scatter range scheduler

Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@lhy1024 lhy1024 marked this pull request as ready for review September 13, 2021 09:45
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 13, 2021
server/schedulers/utils.go Show resolved Hide resolved
server/schedule/opt/healthy.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 13, 2021
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@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 13, 2021
@lhy1024
Copy link
Contributor Author

lhy1024 commented Sep 13, 2021

/merge

@ti-chi-bot
Copy link
Member

@lhy1024: 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: 03b045f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 13, 2021
@ti-chi-bot ti-chi-bot merged commit e9b4f79 into tikv:master Sep 13, 2021
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Sep 13, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4116.

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Sep 13, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4117.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4118.

lhy1024 added a commit to ti-chi-bot/pd that referenced this pull request Sep 14, 2021
…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 <admin@liudos.us>

* fix lint

Signed-off-by: lhy1024 <admin@liudos.us>

* address comments

Signed-off-by: lhy1024 <admin@liudos.us>

* fix lint

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
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 <i@disksing.com>

* fix test

Signed-off-by: disksing <i@disksing.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>

* 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 <admin@liudos.us>

* fix lint

Signed-off-by: lhy1024 <admin@liudos.us>

* address comments

Signed-off-by: lhy1024 <admin@liudos.us>

* fix lint

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>

Co-authored-by: disksing <i@disksing.com>
Co-authored-by: lhy1024 <admin@liudos.us>
ti-chi-bot added a commit that referenced this pull request Oct 13, 2021
…ance config in scatter range scheduler (#4106) (#4118)

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

Signed-off-by: lhy1024 <admin@liudos.us>

* fix lint

Signed-off-by: lhy1024 <admin@liudos.us>

* address comments

Signed-off-by: lhy1024 <admin@liudos.us>

* fix lint

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: lhy1024 <admin@liudos.us>
ti-chi-bot added a commit that referenced this pull request Dec 6, 2021
…ance config in scatter range scheduler (#4106) (#4116)

* This is an automated cherry-pick of #4106

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* fix conflict

Signed-off-by: lhy1024 <admin@liudos.us>

* ref #4399

Signed-off-by: lhy1024 <admin@liudos.us>

* fix test

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: lhy1024 <admin@liudos.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/scheduler Scheduler logic. needs-cherry-pick-release-5.0 The PR needs to cherry pick to release-5.0 branch. needs-cherry-pick-release-5.1 Type: Need cherry pick to release-5.1 needs-cherry-pick-release-5.2 Type: Need cherry pick to release-5.2 release-note The PR should write the 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.

scatter-range-scheduler cannot work well
4 participants