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

storelimit: fix datarace from getOrCreateStoreLimit (#8254) #8258

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #8254

What problem does this PR solve?

Issue Number: Close #8253

What is changed and how does it work?

Check List

Tests

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

go test -timeout 120s -run ^TestConcurrentAddOperatorAndSetStoreLimit$ github.com/tikv/pd/pkg/schedule/operator -race

  • run test TestConcurrentAddOperatorAndSetStoreLimit on master
WARNING: DATA RACE
Write at 0x00c0005ae480 by goroutine 220:
  github.com/tikv/pd/pkg/core/storelimit.(*limit).Reset()
      /home/lhy1024/pd/pkg/core/storelimit/store_limit.go:151 +0x227
  github.com/tikv/pd/pkg/core/storelimit.(*StoreRateLimit).Reset()
      /home/lhy1024/pd/pkg/core/storelimit/store_limit.go:126 +0x3b
  github.com/tikv/pd/pkg/core.(*StoresInfo).ResetStoreLimit.ResetStoreLimit.func1()
      /home/lhy1024/pd/pkg/core/store_option.go:258 +0x14b
  github.com/tikv/pd/pkg/core.(*StoreInfo).Clone()
      /home/lhy1024/pd/pkg/core/store.go:112 +0x17a
  github.com/tikv/pd/pkg/core.(*StoresInfo).ResetStoreLimit()
      /home/lhy1024/pd/pkg/core/store.go:870 +0x208
  github.com/tikv/pd/pkg/schedule/operator.(*Controller).getOrCreateStoreLimit()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller.go:989 +0x2b7
  github.com/tikv/pd/pkg/schedule/operator.(*Controller).ExceedStoreLimit()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller.go:966 +0x464
  github.com/tikv/pd/pkg/schedule/operator.(*Controller).AddOperator()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller.go:355 +0x6b
  github.com/tikv/pd/pkg/schedule/operator.TestConcurrentAddOperatorAndSetStoreLimit.func1()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller_test.go:987 +0x2fb
  github.com/tikv/pd/pkg/schedule/operator.TestConcurrentAddOperatorAndSetStoreLimit.gowrap1()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller_test.go:994 +0x41

Previous read at 0x00c0005ae480 by goroutine 221:
  github.com/tikv/pd/pkg/core/storelimit.(*limit).Available()
      /home/lhy1024/pd/pkg/core/storelimit/store_limit.go:162 +0xb2
  github.com/tikv/pd/pkg/core/storelimit.(*StoreRateLimit).Available()
      /home/lhy1024/pd/pkg/core/storelimit/store_limit.go:101 +0x3a
  github.com/tikv/pd/pkg/schedule/operator.(*Controller).ExceedStoreLimit()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller.go:970 +0x4e5
  github.com/tikv/pd/pkg/schedule/operator.(*Controller).AddOperator()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller.go:355 +0x6b
  github.com/tikv/pd/pkg/schedule/operator.TestConcurrentAddOperatorAndSetStoreLimit.func1()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller_test.go:987 +0x2fb
  github.com/tikv/pd/pkg/schedule/operator.TestConcurrentAddOperatorAndSetStoreLimit.gowrap1()
      /home/lhy1024/pd/pkg/schedule/operator/operator_controller_test.go:994 +0x41
  • run test TestConcurrentAddOperatorAndSetStoreLimit with this PR
ok  	github.com/tikv/pd/pkg/schedule/operator	1.473s

Release note

None.

Signed-off-by: lhy1024 <[email protected]>
Signed-off-by: lhy1024 <[email protected]>
Signed-off-by: lhy1024 <[email protected]>
@ti-chi-bot ti-chi-bot added dco-signoff: yes Indicates the PR's author has signed the dco. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-8.1 This PR is cherry-picked to release-8.1 from a source PR. labels Jun 5, 2024
Copy link
Contributor

ti-chi-bot bot commented Jun 5, 2024

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • HuSharp
  • 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 bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 5, 2024
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 5, 2024
@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Jun 6, 2024
@nolouch
Copy link
Contributor

nolouch commented Jun 6, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented Jun 6, 2024

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

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Jun 6, 2024

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

Commit hash: 4bb12de

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 6, 2024
@ti-chi-bot ti-chi-bot bot merged commit d1bf242 into tikv:release-8.1 Jun 6, 2024
20 of 21 checks passed
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. dco-signoff: yes Indicates the PR's author has signed the dco. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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-8.1 This PR is cherry-picked to release-8.1 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants