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: always switch to a different peer when meets no-leader (#22449) #23595

Merged
merged 1 commit into from
Mar 26, 2021

Conversation

ti-srebot
Copy link
Contributor

@ti-srebot ti-srebot commented Mar 26, 2021

cherry-pick #22449 to release-5.0
You can switch your code base to this Pull Request by using git-extras:

# In tidb repo:
git pr https://github.com/pingcap/tidb/pull/23595

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/tidb.git pr/23595:release-5.0-2df2ca06d27c

Signed-off-by: youjiali1995 zlwgx1023@gmail.com

What problem does this PR solve?

Issue Number: close #22400
Problem Summary:

Joint consensus is enabled in master, which is possible to make a leader step down as a learner during a conf change. And hibernate region is also enabled by default in master, so after the leader step down, there can be a long time that there is no leader in the region until requests are sent to followers or hibernate timeout. But from logs, I can see TiDB keeps querying the learner instead of trying other followers, hence it keeps timeout until hibernate is woken up.

What is changed and how it works?

What's Changed:

One solution is always to try a different peer when meets no-leader. There is a small probability that the current peer who reports not-leader becomes a leader and TiDB has to retry once in this case.

Related changes

Check List

Tests

  • Unit test

Release note

  • No release note

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added component/store sig/sql-infra SIG: SQL Infra sig/transaction SIG:Transaction size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/5.0-cherry-pick labels Mar 26, 2021
@ti-srebot ti-srebot added this to the v5.0.0 ga milestone Mar 26, 2021
@ti-srebot
Copy link
Contributor Author

@youjiali1995 you're already a collaborator in bot's repo.

@cfzjywxk
Copy link
Contributor

LGTM

@ti-chi-bot
Copy link
Member

@cfzjywxk: 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 26, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • MyonKeminta
  • youjiali1995

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@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 Mar 26, 2021
@youjiali1995
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 09c1ef4

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 26, 2021
@lysu
Copy link
Contributor

lysu commented Mar 26, 2021

/run-common-test
/run-integration-common-test

@youjiali1995
Copy link
Contributor

/run-unit-test

@ti-chi-bot ti-chi-bot merged commit ef2f33f into pingcap:release-5.0 Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/store sig/sql-infra SIG: SQL Infra sig/transaction SIG:Transaction size/L Denotes a PR that changes 100-499 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/5.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants