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

stmtctx: add mutex to protect stmtCache(#36159) #36351

Merged
merged 23 commits into from
Jul 21, 2022

Conversation

pingandb
Copy link
Contributor

@pingandb pingandb commented Jul 20, 2022

What problem does this PR solve?

Issue Number: close #36159

Problem Summary: tidb_server panic which concurrently accessing stmtCache

What is changed and how it works?

stmtctx/stmtctx.go was changed, add mutex to protect stmtCache

Check List

Tests

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

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

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 20, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Reminiscent
  • qw4990

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-6.0 needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. labels Jul 20, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Jul 20, 2022

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 20, 2022
@ti-chi-bot
Copy link
Member

Welcome @pingandb!

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. 😃

@sre-bot
Copy link
Contributor

sre-bot commented Jul 20, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@chrysan chrysan requested a review from qw4990 July 20, 2022 02:38
@qw4990 qw4990 requested a review from Reminiscent July 20, 2022 02:40
@sre-bot
Copy link
Contributor

sre-bot commented Jul 20, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 20, 2022
@qw4990
Copy link
Contributor

qw4990 commented Jul 20, 2022

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Jul 20, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 20, 2022
@pingandb pingandb requested a review from a team as a code owner July 20, 2022 03:17
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 20, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Jul 20, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 20, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Jul 20, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@sre-bot
Copy link
Contributor

sre-bot commented Jul 20, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@ti-chi-bot
Copy link
Member

@fixdb: /merge is only allowed for the committers, you can assign this pull request to the committer in list by filling /assign @committer in the comment to help merge this pull request.

In response to this:

/merge

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.

@hawkingrei
Copy link
Member

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 20, 2022
@chrysan
Copy link
Contributor

chrysan commented Jul 20, 2022

/run-unit-test

@hawkingrei
Copy link
Member

/unhold

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 20, 2022
@hawkingrei
Copy link
Member

/run-check_dev_2

1 similar comment
@hawkingrei
Copy link
Member

/run-check_dev_2

@ti-chi-bot ti-chi-bot merged commit 5f3252c into pingcap:master Jul 21, 2022
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 21, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-5.3 in PR #36388

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 21, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-5.4 in PR #36389

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 21, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-6.0 in PR #36390

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 21, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-6.1 in PR #36391

@ti-srebot
Copy link
Contributor

cherry pick to release-6.2 failed

@sre-bot
Copy link
Contributor

sre-bot commented Aug 20, 2022

TiDB MergeCI notify

✅ Well Done! New fixed [1] after this pr merged.

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🔴 all 36 tests passed 24 min Existing failure
idc-jenkins-ci-tidb/integration-common-test 🔴 all 11 tests passed 12 min Existing failure
idc-jenkins-ci-tidb/integration-ddl-test ✅ all 6 tests passed 5 min 40 sec Fixed
idc-jenkins-ci-tidb/common-test 🟢 all 11 tests passed 6 min 24 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 4 min 40 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 7 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 13 tests passed 4 min 36 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 0 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 2 min 49 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

@sre-bot
Copy link
Contributor

sre-bot commented Sep 14, 2022

TiDB MergeCI notify

✅ Well Done! New fixed [1] after this pr merged.

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🔴 all 31 tests passed 28 min Existing failure
idc-jenkins-ci-tidb/integration-common-test 🔴 all 11 tests passed 6 min 14 sec Existing failure
idc-jenkins-ci-tidb/integration-ddl-test ✅ all 6 tests passed 4 min 58 sec Fixed
idc-jenkins-ci-tidb/common-test 🟢 all 11 tests passed 3 min 35 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 5 min 24 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 7 min 58 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 13 tests passed 4 min 7 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 15 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 3 min 3 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 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. 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

concurrent map writes of stmtCache map[StmtCacheKey]interface{} when enable prepared plan cache
10 participants