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

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

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #4570

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.

@ti-chi-bot
Copy link
Member Author

ti-chi-bot commented Jan 14, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • HunDunDM
  • 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.

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 do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. component/schedule Scheduling logic. type/bugfix This PR fixes a bug. type/cherry-pick-for-release-5.0 The PR belongs to release-5.0 cherry pick. labels Jan 14, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 14, 2022
@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
@HunDunDM HunDunDM force-pushed the cherry-pick-4570-to-release-5.0 branch from 76519b2 to 87ffadc Compare January 14, 2022 09:12
@codecov
Copy link

codecov bot commented Jan 14, 2022

Codecov Report

Merging #4578 (b6ce700) into release-5.0 (552c53e) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release-5.0    #4578      +/-   ##
===============================================
- Coverage        74.98%   74.92%   -0.06%     
===============================================
  Files              245      245              
  Lines            24446    24450       +4     
===============================================
- Hits             18331    18320      -11     
- Misses            4500     4508       +8     
- Partials          1615     1622       +7     
Flag Coverage Δ
unittests 74.92% <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 86.34% <100.00%> (+0.24%) ⬆️
pkg/tempurl/tempurl.go 45.00% <0.00%> (-15.00%) ⬇️
server/id/id.go 76.19% <0.00%> (-4.77%) ⬇️
server/schedulers/random_merge.go 60.00% <0.00%> (-3.34%) ⬇️
pkg/dashboard/adapter/manager.go 79.78% <0.00%> (-3.20%) ⬇️
client/base_client.go 82.47% <0.00%> (-2.07%) ⬇️
server/member/member.go 65.21% <0.00%> (-1.64%) ⬇️
server/tso/global_allocator.go 71.01% <0.00%> (-1.45%) ⬇️
server/tso/allocator_manager.go 75.24% <0.00%> (-1.33%) ⬇️
pkg/btree/btree.go 85.30% <0.00%> (-0.97%) ⬇️
... 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 552c53e...b6ce700. Read the comment docs.

@VelocityLight VelocityLight added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jun 13, 2022
@nolouch
Copy link
Contributor

nolouch commented Jun 13, 2022

/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: b6ce700

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 13, 2022
@ti-chi-bot ti-chi-bot merged commit 498d5db into tikv:release-5.0 Jun 13, 2022
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/schedule Scheduling 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/bugfix This PR fixes a bug. type/cherry-pick-for-release-5.0 The PR belongs to release-5.0 cherry pick.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants