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

store/tikv: fix misuse of PD client's GetStore #23695

Merged
merged 7 commits into from
Mar 31, 2021

Conversation

longfangsong
Copy link
Contributor

Signed-off-by: longfangsong longfangsong@icloud.com

What problem does this PR solve?

Issue Number: close #23676

Problem Summary:

  • TiDB wrongly uses the PD client's GetStore(), which may result in dead loops.
  • store.State isn't changed if it becomes a tombstone

What is changed and how it works?

What's Changed:

Skip the early-return if branch when "load Store from PD success but pd didn't found the store"

How it Works:

By checking the error message. This is a quick and dirty solution. A better solution (which needs to change the pdClient, and maybe the whole way of our error handling process) needs more discussion.

Related changes

  • Need to cherry-pick to the release branch
    Needs to cherry-pick to 5.0.

Check List

Tests

  • Unit test
  • Integration test

Release note

  • No release note

@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 30, 2021
Signed-off-by: longfangsong <longfangsong@icloud.com>
@ti-chi-bot ti-chi-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 30, 2021
@longfangsong
Copy link
Contributor Author

/cc @youjiali1995

@longfangsong longfangsong requested a review from a team as a code owner March 30, 2021 11:46
@longfangsong longfangsong requested review from winoros and removed request for a team March 30, 2021 11:46
Signed-off-by: longfangsong <longfangsong@icloud.com>
(cherry picked from commit 630d390e5c414b92d749b8df7e470c6b21310f4e)
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 30, 2021
store/tikv/region_cache.go Outdated Show resolved Hide resolved
store/tikv/region_cache.go Outdated Show resolved Hide resolved
@youjiali1995
Copy link
Contributor

Seems the root cause of #22907 is not this PR. Nevertheless, this PR fixes some problems.

@youjiali1995 youjiali1995 added the sig/transaction SIG:Transaction label Mar 30, 2021
@ichn-hu ichn-hu mentioned this pull request Mar 30, 2021
Signed-off-by: longfangsong <longfangsong@icloud.com>
Signed-off-by: longfangsong <longfangsong@icloud.com>
@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 30, 2021
Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Member

@MyonKeminta: Please use /LGTM instead of LGTM when you want to approve the pull request by comment.
If you use the GitHub review feature, please approve the PR directly, the comment will not take effect in the GitHub review feature.
If you have any qustions please refer to lgtm command help or lgtm plugin design.

If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1.

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.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 30, 2021
@lysu
Copy link
Contributor

lysu commented Mar 30, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: ac0a96e

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 30, 2021
@ti-chi-bot ti-chi-bot merged commit addbd46 into pingcap:master Mar 31, 2021
@zhangjinpeng87
Copy link
Contributor

Should we pick this fix to 5.0?

@youjiali1995
Copy link
Contributor

Should we pick this fix to 5.0?

@zhangjinpeng1987 No. Even though TiDB wrongly uses it, TiDB works well with no issues.

@youjiali1995
Copy link
Contributor

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #24498

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request May 8, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-3.0 in PR #24499

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request May 8, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #24500

youjiali1995 pushed a commit to ti-srebot/tidb that referenced this pull request May 12, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
youjiali1995 pushed a commit to youjiali1995/tidb that referenced this pull request Jun 30, 2021
youjiali1995 pushed a commit to youjiali1995/tidb that referenced this pull request Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 sig/transaction SIG:Transaction 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiDB wrongly uses PD client's GetStore which may result in dead loops
8 participants