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

use leader read when tryFollower is fallback from accessKnownLeader #952

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

you06
Copy link
Contributor

@you06 you06 commented Aug 21, 2023

Recently, we made some changes to the selector states, the tryFollower is not only used as a fallback state of accessKnownLeader, this PR keeps the compatibility of tryFollower's requests.

Before the changes we made:

accessKnownLeader -> tryFollower -> switch leader when success, and the flag KVContext.ReplicaRead is always false here.

Now there is another path lead to tryFollower state:

accessFollower -> tryFollower, in this case, KVContext.ReplicaRead is set to true in tryFollower state.

To make the behavior compatible with earlier versions, we need to set a flag for the accessKnownLeader -> tryFollower path, and that's fromKnownLeader. It's renamed from fromOnNotLeader for better semantic.

cc @crazycs520

Signed-off-by: you06 <[email protected]>
@crazycs520
Copy link
Contributor

@cfzjywxk @zyguan @ekexium PTAL

Signed-off-by: you06 <[email protected]>
@cfzjywxk cfzjywxk merged commit 1ea3d66 into tikv:master Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants