Skip to content

use leader read when tryFollower is fallback from accessKnownLeader#952

Merged
cfzjywxk merged 2 commits intotikv:masterfrom
you06:fix-try-follower
Aug 22, 2023
Merged

use leader read when tryFollower is fallback from accessKnownLeader#952
cfzjywxk merged 2 commits intotikv:masterfrom
you06:fix-try-follower

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 <you1474600@gmail.com>
@crazycs520
Copy link
Contributor

@cfzjywxk @zyguan @ekexium PTAL

Signed-off-by: you06 <you1474600@gmail.com>
@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