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

schedule: fix race for region scatter (#3760) #3762

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #3760

Signed-off-by: yisaer disxiaofei@163.com

What problem does this PR solve?

As totalCountByStore calling the function getDistributionByGroupLocked, this function should be procteded by rw mutex otherwise it will cause data race panic

What is changed and how it works?

Add mutex to protect it.

Check List

Tests

  • Unit test

Release note

Fix pd may get panic during scattering region

Signed-off-by: yisaer <disxiaofei@163.com>
@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. type/cherry-pick-for-release-5.0 The PR belongs to release-5.0 cherry pick. do-not-merge/cherry-pick-not-approved labels Jun 10, 2021
@ti-chi-bot ti-chi-bot requested a review from nolouch June 10, 2021 04:37
@codecov
Copy link

codecov bot commented Jun 10, 2021

Codecov Report

Merging #3762 (83435fc) into release-5.0 (f4d1a86) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release-5.0    #3762      +/-   ##
===============================================
+ Coverage        74.61%   74.66%   +0.05%     
===============================================
  Files              245      245              
  Lines            24183    24185       +2     
===============================================
+ Hits             18043    18057      +14     
+ Misses            4521     4514       -7     
+ Partials          1619     1614       -5     
Flag Coverage Δ
unittests 74.66% <100.00%> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
server/schedule/region_scatterer.go 88.47% <100.00%> (+0.10%) ⬆️
server/schedulers/shuffle_hot_region.go 54.73% <0.00%> (-9.48%) ⬇️
server/tso/local_allocator.go 73.61% <0.00%> (-6.95%) ⬇️
server/election/lease.go 89.83% <0.00%> (-5.09%) ⬇️
tools/pd-ctl/pdctl/command/operator.go 65.99% <0.00%> (-1.22%) ⬇️
server/server.go 73.38% <0.00%> (-0.91%) ⬇️
server/config/persist_options.go 91.33% <0.00%> (-0.79%) ⬇️
server/handler.go 41.97% <0.00%> (-0.50%) ⬇️
client/client.go 72.24% <0.00%> (+0.13%) ⬆️
client/base_client.go 85.94% <0.00%> (+0.54%) ⬆️
... 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 f4d1a86...83435fc. Read the comment docs.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 10, 2021
@ti-chi-bot
Copy link
Member Author

[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 25, 2021
@zhouqiang-cl zhouqiang-cl added the cherry-pick-approved Cherry pick PR approved by release team. label Jun 25, 2021
@nolouch
Copy link
Contributor

nolouch commented Jun 25, 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: 3521301

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 25, 2021
@ti-chi-bot ti-chi-bot merged commit b570054 into tikv:release-5.0 Jun 25, 2021
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. 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.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