-
Notifications
You must be signed in to change notification settings - Fork 721
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 datarace in operator.check
(#8264)
#8578
schedule: fix datarace in operator.check
(#8264)
#8578
Conversation
Signed-off-by: husharp <[email protected]>
dc5daf2
to
7b750ff
Compare
In release 7.1, run test will meet data race only for variable go clean -testcache
go test -timeout 120s -run ^TestOperatorCheckConcurrently$ github.com/tikv/pd/server/schedule/operator -race pingcap@MacBook-Pro-2 ~/CS/PingCAP/pd
cherry-pick-8264-to-release-6.5* $ go test -timeout 120s -run ^TestOperatorCheckConcurrently$ github.com/tikv/pd/server/schedule/operator -race ==================
WARNING: DATA RACE
Read at 0x00c0005aa228 by goroutine 167:
github.com/tikv/pd/pkg/schedule/operator.(*Operator).Check()
/Users/pingcap/CS/PingCAP/pd/pkg/schedule/operator/operator.go:317 +0x418
github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently.func1()
/Users/pingcap/CS/PingCAP/pd/pkg/schedule/operator/operator_test.go:553 +0x8c
Previous write at 0x00c0005aa228 by goroutine 166:
??()
-:0 +0x1041769f4
sync/atomic.CompareAndSwapInt64()
<autogenerated>:1 +0x18
github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently.func1()
/Users/pingcap/CS/PingCAP/pd/pkg/schedule/operator/operator_test.go:553 +0x8c
Goroutine 167 (running) created at:
github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently()
/Users/pingcap/CS/PingCAP/pd/pkg/schedule/operator/operator_test.go:551 +0x368
testing.tRunner()
/opt/homebrew/opt/go/libexec/src/testing/testing.go:1595 +0x1b0
testing.(*T).Run.func1()
/opt/homebrew/opt/go/libexec/src/testing/testing.go:1648 +0x40
Goroutine 166 (running) created at:
github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently()
/Users/pingcap/CS/PingCAP/pd/pkg/schedule/operator/operator_test.go:551 +0x368
testing.tRunner()
/opt/homebrew/opt/go/libexec/src/testing/testing.go:1595 +0x1b0
testing.(*T).Run.func1()
/opt/homebrew/opt/go/libexec/src/testing/testing.go:1648 +0x40
==================
--- FAIL: TestOperatorCheckConcurrently (0.00s)
testing.go:1465: race detected during execution of test
FAIL
FAIL github.com/tikv/pd/pkg/schedule/operator 0.574s
FAIL
|
Signed-off-by: husharp <[email protected]>
@okJiang: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this: 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 kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: HuSharp, lhy1024, okJiang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is an automated cherry-pick of #8264
What problem does this PR solve?
Issue Number: Close #8263
What is changed and how does it work?
Check List
Tests
go test -timeout 120s -run ^TestOperatorCheckConcurrently$ github.com/tikv/pd/pkg/schedule/operator -race
Release note