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

region cache: prevent send read request to learner peer #23272

Closed
wants to merge 2 commits into from

Conversation

nolouch
Copy link
Member

@nolouch nolouch commented Mar 11, 2021

Signed-off-by: nolouch nolouch@gmail.com

What problem does this PR solve?

ref #23271

Problem Summary:

What is changed and how it works?

What's Changed: the session variable only says leader and follower, so we do not send to the learner at first. and in the normal TiKV cluster, learner only is a intermediate state.

How it Works: skip the peer role is learner

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Release note

  • No release note

Signed-off-by: nolouch <nolouch@gmail.com>
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

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 the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 11, 2021
@ti-srebot
Copy link
Contributor

Signed-off-by: nolouch <nolouch@gmail.com>
Comment on lines +1326 to +1334
for i := 0; i < rs.accessStoreNum(TiKVOnly); i++ {
store, peer, accessIdx, storeIdx = r.getKvStorePeer(rs, rs.kvPeer(followerStoreSeed, op))
if peer.Role == metapb.PeerRole_Learner {
followerStoreSeed++
continue
}
return
}
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe doing it in kvPeer() will be clearer? kvPeer() is only called by AnyStorePeer.

@nolouch nolouch added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 15, 2021
@nolouch nolouch closed this Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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.

4 participants