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

owner: fix data race on ownerManager.campaignCancel #56362

Merged
merged 6 commits into from
Sep 27, 2024

Conversation

fishiu
Copy link
Contributor

@fishiu fishiu commented Sep 27, 2024

What problem does this PR solve?

Issue Number: close #56053

Problem Summary: m.campaignCancel is currently set in campaignLoop goroutine, which might happen after calling campaignCancel() that access m.campaignCancel, even though it is called after CampaignOwner().

What changed and how does it work?

Set m.campaignCancel in CampaignOwner() rather than in campaignLoop goroutine, to ensure a campaignCancel() called after CampaignOwner() can always access m.campaignCancel instead of nil.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@sre-bot
Copy link
Contributor

sre-bot commented Sep 27, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

ti-chi-bot bot commented Sep 27, 2024

Welcome @fishiu!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Sep 27, 2024
Copy link

ti-chi-bot bot commented Sep 27, 2024

Hi @fishiu. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

Copy link

tiprow bot commented Sep 27, 2024

Hi @fishiu. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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-sigs/prow repository.

@fishiu fishiu changed the title fix data race of ownerManager.campaignCancel owner: fix data race on ownerManager.campaignCancel Sep 27, 2024
pkg/owner/manager_test.go Outdated Show resolved Hide resolved
pkg/owner/manager_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 27, 2024
pkg/owner/manager.go Outdated Show resolved Hide resolved
fishiu and others added 2 commits September 27, 2024 14:53
remove comment

Co-authored-by: lance6716 <[email protected]>
reduce loops

Co-authored-by: lance6716 <[email protected]>
@lance6716
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Sep 27, 2024
Copy link

ti-chi-bot bot commented Sep 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, tangenta

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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 27, 2024
Copy link

ti-chi-bot bot commented Sep 27, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-27 06:52:50.833050281 +0000 UTC m=+1808040.573474235: ☑️ agreed by lance6716.
  • 2024-09-27 07:02:41.366122237 +0000 UTC m=+1808631.106546176: ☑️ agreed by tangenta.

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.3609%. Comparing base (73f1cfe) to head (4dd52fb).
Report is 10 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #56362        +/-   ##
================================================
+ Coverage   73.3876%   75.3609%   +1.9732%     
================================================
  Files          1620       1622         +2     
  Lines        447041     447797       +756     
================================================
+ Hits         328073     337464      +9391     
+ Misses        98869      89840      -9029     
- Partials      20099      20493       +394     
Flag Coverage Δ
integration 48.9985% <100.0000%> (?)
unit 72.4809% <100.0000%> (+0.0027%) ⬆️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 52.2712% <ø> (+6.7386%) ⬆️

@fishiu
Copy link
Contributor Author

fishiu commented Sep 27, 2024

/retest

1 similar comment
@hawkingrei
Copy link
Member

/retest

@fishiu
Copy link
Contributor Author

fishiu commented Sep 27, 2024

/retest

1 similar comment
@fishiu
Copy link
Contributor Author

fishiu commented Sep 27, 2024

/retest

Copy link

ti-chi-bot bot commented Sep 27, 2024

@fishiu: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/check_dev_2 4dd52fb link unknown /test check-dev2

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit afdd5c2 into pingcap:master Sep 27, 2024
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ownerManager has race even when its methods are serialized called
5 participants