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 datarace in operator.check (#8264) #8469

Merged

Conversation

ti-chi-bot
Copy link
Member

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

  • Unit test
  • Manual test (add detailed scripts or steps below)
    go test -timeout 120s -run ^TestOperatorCheckConcurrently$ github.com/tikv/pd/pkg/schedule/operator -race
  • in master
==================
WARNING: DATA RACE
Read at 0x00c0004dc240 by goroutine 212:
  github.com/tikv/pd/pkg/schedule/operator.(*Operator).Check()
      /home/lhy1024/pd/pkg/schedule/operator/operator.go:382 +0x5c4
  github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently.func1()
      /home/lhy1024/pd/pkg/schedule/operator/operator_test.go:593 +0xbe

Previous write at 0x00c0004dc240 by goroutine 215:
  sync/atomic.CompareAndSwapInt64()
      /usr/lib/go/src/runtime/race_amd64.s:316 +0xb
  sync/atomic.CompareAndSwapInt64()
      <autogenerated>:1 +0x1a
  github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently.func1()
      /home/lhy1024/pd/pkg/schedule/operator/operator_test.go:593 +0xbe

Goroutine 212 (running) created at:
  github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently()
      /home/lhy1024/pd/pkg/schedule/operator/operator_test.go:591 +0x487
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/lib/go/src/testing/testing.go:1742 +0x44

Goroutine 215 (running) created at:
  github.com/tikv/pd/pkg/schedule/operator.TestOperatorCheckConcurrently()
      /home/lhy1024/pd/pkg/schedule/operator/operator_test.go:591 +0x487
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/lib/go/src/testing/testing.go:1742 +0x44
==================
--- FAIL: TestOperatorCheckConcurrently (0.00s)
    testing.go:1398: race detected during execution of test
FAIL
FAIL    github.com/tikv/pd/pkg/schedule/operator        0.103s
FAIL
  • with this pr
ok      github.com/tikv/pd/pkg/schedule/operator        1.098s

Release note

None.

@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. labels Jul 31, 2024
@ti-chi-bot ti-chi-bot added the type/cherry-pick-for-release-8.1 This PR is cherry-picked to release-8.1 from a source PR. label Jul 31, 2024
@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Jul 31, 2024
Signed-off-by: lhy1024 <[email protected]>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 1, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HuSharp, rleungx

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 1, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 1, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-01 03:43:20.521723147 +0000 UTC m=+413716.801771206: ☑️ agreed by rleungx.
  • 2024-08-01 06:25:31.51106262 +0000 UTC m=+423447.791110690: ☑️ agreed by HuSharp.

@ti-chi-bot ti-chi-bot bot merged commit 85258b3 into tikv:release-8.1 Aug 1, 2024
21 checks passed
@HuSharp HuSharp deleted the cherry-pick-8264-to-release-8.1 branch August 1, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. dco-signoff: yes Indicates the PR's author has signed the dco. lgtm 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants