-
Notifications
You must be signed in to change notification settings - Fork 719
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
Conversation
Signed-off-by: lhy1024 <[email protected]>
Signed-off-by: lhy1024 <[email protected]>
Signed-off-by: lhy1024 <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8254 +/- ##
==========================================
+ Coverage 77.30% 77.35% +0.05%
==========================================
Files 471 471
Lines 61370 61375 +5
==========================================
+ Hits 47443 47478 +35
+ Misses 10372 10329 -43
- Partials 3555 3568 +13
Flags with carried forward coverage won't be shown. Click here to find out more. |
Signed-off-by: lhy1024 <[email protected]>
} | ||
|
||
// Reset resets the rate limit. | ||
func (l *limit) Reset(ratePerSec float64) { | ||
l.ratePerSecMutex.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it happen in the current code or just in your testing code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think datarace can happen in the current code, we call getOrCreateStoreLimit
in many places now, like in AddOperator
or tryAddOperators
, where we call ExceedStoreLimit
to check the limit.
If the getOrCreateStoreLimit
enters the ResetStoreLimit
branch, then datarace is possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And just like the test I built, this scenario is also possible to datarace if we set storelimit when other code calls getOrCreateStoreLimit
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems it is caused by #8032
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/merge |
@lhy1024: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
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. |
This pull request has been accepted and is ready to merge. Commit hash: 4185a77
|
/run-cherry-picker |
In response to a cherrypick label: new pull request created to branch |
close #8253 Signed-off-by: lhy1024 <[email protected]> Co-authored-by: lhy1024 <[email protected]>
What problem does this PR solve?
Issue Number: Close #8253
What is changed and how does it work?
Check List
Tests
go test -timeout 120s -run ^TestConcurrentAddOperatorAndSetStoreLimit$ github.com/tikv/pd/pkg/schedule/operator -race
TestConcurrentAddOperatorAndSetStoreLimit
on masterTestConcurrentAddOperatorAndSetStoreLimit
with this PRRelease note