Skip to content

region_scatterer: fix the bug that could generate schedule with too few peers#4570

Merged
ti-chi-bot merged 6 commits intotikv:masterfrom
HunDunDM:fix-4565
Jan 14, 2022
Merged

region_scatterer: fix the bug that could generate schedule with too few peers#4570
ti-chi-bot merged 6 commits intotikv:masterfrom
HunDunDM:fix-4565

Conversation

@HunDunDM
Copy link
Copy Markdown
Member

@HunDunDM HunDunDM commented Jan 13, 2022

What problem does this PR solve?

close #4565

What is changed and how it works?

If an originPeer is already in selectStore, continue directly. Otherwise, it will end up picking a targetPeer which is either itself or some other store that is not in the initial peer list. Since entering the select phase, it is guaranteed that it is not in the selectStore, so it is always guaranteed that the worst-case selection itself is feasible at this time. In the end, the number of peers before and after can be guaranteed to remain unchanged.

Check List

Tests

  • Unit test

When not modified, the following operator may be generated:

scatter-region {rm peer: store [3]} (kind:region,leader, region:201(0,0), createAt:2022-01-13 18:24:32.375399 +0800 CST m=+0.014571751, startAt:0001-01-01 00:00:00 +0000 UTC, currentStep:0, steps:[transfer leader from store 3 to store 4, remove peer on store 3])

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch

Release note

Fix the bug that the region scatterer may generate the schedule with too few peers.

@HunDunDM HunDunDM added component/schedule Scheduling logic. type/bugfix This PR fixes a bug. labels Jan 13, 2022
@ti-chi-bot
Copy link
Copy Markdown
Member

ti-chi-bot commented Jan 13, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Yisaer
  • lhy1024

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.

Details

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jan 13, 2022
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 13, 2022

Codecov Report

Merging #4570 (eed68c7) into master (32832a3) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4570      +/-   ##
==========================================
+ Coverage   74.83%   74.89%   +0.06%     
==========================================
  Files         265      265              
  Lines       27904    27908       +4     
==========================================
+ Hits        20883    20903      +20     
+ Misses       5154     5137      -17     
- Partials     1867     1868       +1     
Flag Coverage Δ
unittests 74.89% <100.00%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
server/schedule/region_scatterer.go 83.19% <100.00%> (+0.28%) ⬆️
server/region_syncer/client.go 78.90% <0.00%> (-4.69%) ⬇️
server/tso/tso.go 61.93% <0.00%> (-2.28%) ⬇️
server/tso/allocator_manager.go 64.89% <0.00%> (-1.34%) ⬇️
server/tso/global_allocator.go 60.84% <0.00%> (-1.06%) ⬇️
server/config/persist_options.go 91.72% <0.00%> (-0.76%) ⬇️
tools/pd-ctl/pdctl/command/hot_command.go 71.03% <0.00%> (-0.69%) ⬇️
server/cluster/cluster.go 83.10% <0.00%> (-0.24%) ⬇️
server/grpc_service.go 51.40% <0.00%> (-0.20%) ⬇️
server/server.go 72.60% <0.00%> (-0.15%) ⬇️
... and 12 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 32832a3...eed68c7. Read the comment docs.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 13, 2022
…ew peers

close tikv#4565

Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
@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 Jan 14, 2022
Signed-off-by: HunDunDM <hundundm@gmail.com>
@nolouch
Copy link
Copy Markdown
Contributor

nolouch commented Jan 14, 2022

/merge

@ti-chi-bot
Copy link
Copy Markdown
Member

@nolouch: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

Details

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
Copy Markdown
Member

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

DetailsCommit hash: eed68c7

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 14, 2022
@ti-chi-bot ti-chi-bot merged commit c31556a into tikv:master Jan 14, 2022
@HunDunDM HunDunDM deleted the fix-4565 branch January 14, 2022 08:27
@nolouch nolouch added 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 labels Jan 14, 2022
nolouch pushed a commit to ti-chi-bot/pd that referenced this pull request Jan 14, 2022
…ew peers (tikv#4570)

Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: nolouch <nolouch@gmail.com>
HunDunDM added a commit to ti-chi-bot/pd that referenced this pull request Jan 14, 2022
…ew peers (tikv#4570)

close tikv#4565

Signed-off-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot added a commit that referenced this pull request Jan 14, 2022
…ew peers (#4570) (#4581)

Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: nolouch <nolouch@gmail.com>

Co-authored-by: 混沌DM <hundundm@gmail.com>
HunDunDM added a commit to ti-chi-bot/pd that referenced this pull request Jan 14, 2022
…ew peers (tikv#4570)

close tikv#4565

Signed-off-by: HunDunDM <hundundm@gmail.com>
HunDunDM added a commit to ti-chi-bot/pd that referenced this pull request Jan 14, 2022
…ew peers (tikv#4570)

close tikv#4565

Signed-off-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot added a commit that referenced this pull request Jan 21, 2022
…ew peers (#4570) (#4579)

* region_scatterer: fix the bug that could generate schedule with too few peers (#4570)

close #4565

Signed-off-by: HunDunDM <hundundm@gmail.com>

* region_scatterer: fix incorrect test (#4586)

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot added a commit that referenced this pull request Feb 22, 2022
…ew peers (#4570) (#4577)

close #4565, ref #4570

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
Co-authored-by: JmPotato <ghzpotato@gmail.com>
ti-chi-bot added a commit that referenced this pull request Apr 14, 2022
…ew peers (#4570) (#4580)

close #4565, ref #4570

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
Co-authored-by: 混沌DM <hundundm@gmail.com>
ti-chi-bot added a commit that referenced this pull request Jun 13, 2022
…ew peers (#4570) (#4578)

close #4565, ref #4570

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot pushed a commit that referenced this pull request Feb 7, 2023
…any peers (#5920)

ref #4570, close #5909

Signed-off-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 7, 2023
ref tikv#4570, close tikv#5909

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 7, 2023
ref tikv#4570, close tikv#5909

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 7, 2023
ref tikv#4570, close tikv#5909

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 7, 2023
ref tikv#4570, close tikv#5909

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 7, 2023
ref tikv#4570, close tikv#5909

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 7, 2023
ref tikv#4570, close tikv#5909

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot added a commit that referenced this pull request Feb 13, 2023
…any peers (#5920) (#5923)

ref #4570, close #5909, ref #5920

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot added a commit that referenced this pull request Mar 27, 2023
…any peers (#5920) (#5929)

ref #4570, close #5909, ref #5920

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

Co-authored-by: 混沌DM <hundundm@gmail.com>
Co-authored-by: Cabinfever_B <cabinfeveroier@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-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 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. 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/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peer is accidently removed when scatter region

5 participants