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 <lance6716@gmail.com>
reduce loops

Co-authored-by: lance6716 <lance6716@gmail.com>
@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 248 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%) ⬆️

@Benjamin2037 Benjamin2037 added needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Nov 5, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 5, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.4: #57128.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request could not be created: failed to create pull request against pingcap/tidb#release-7.1 from head ti-chi-bot:cherry-pick-56362-to-release-7.1: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for ti-chi-bot:cherry-pick-56362-to-release-7.1."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 5, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 5, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #57129.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 5, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #57130.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #57131.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 5, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 5, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #57132.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #57133.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 5, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
bb7133 pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 11, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. 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
8 participants