-
Notifications
You must be signed in to change notification settings - Fork 220
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
Remove stale-read flag after resolving lock #792
Conversation
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
tikvrpc/tikvrpc.go
Outdated
@@ -275,6 +275,12 @@ func (req *Request) EnableStaleRead() { | |||
req.ReplicaRead = false | |||
} | |||
|
|||
// DisableStaleRead is called when stale-read fallbacks to leader read after meeting key-is-locked error. | |||
func (req *Request) DisableStaleRead() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about DisableStaleReadAfterFallback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename it with DisableStaleReadMeetLock
because it should only take effect when key is locked, other rollback won't affect this flag
Signed-off-by: you06 <you1474600@gmail.com>
…disable-stale-read
/test |
Signed-off-by: you06 <you1474600@gmail.com>
* remove stale-read when key-is-locked Signed-off-by: you06 <you1474600@gmail.com> * disable follower read for batch get Signed-off-by: you06 <you1474600@gmail.com> * the stale-read flag may already set to false Signed-off-by: you06 <you1474600@gmail.com> * fix batchget Signed-off-by: you06 <you1474600@gmail.com> * Reset busy-threshold when stale read fallback to leader read Signed-off-by: you06 <you1474600@gmail.com> * address comment Signed-off-by: you06 <you1474600@gmail.com> * trigger CI Signed-off-by: you06 <you1474600@gmail.com> --------- Signed-off-by: you06 <you1474600@gmail.com>
* add metrics for stale-read traffic (#776) Signed-off-by: you06 <you1474600@gmail.com> * Remove stale-read flag after resolving lock (#792) * remove stale-read when key-is-locked Signed-off-by: you06 <you1474600@gmail.com> * disable follower read for batch get Signed-off-by: you06 <you1474600@gmail.com> * the stale-read flag may already set to false Signed-off-by: you06 <you1474600@gmail.com> * fix batchget Signed-off-by: you06 <you1474600@gmail.com> * Reset busy-threshold when stale read fallback to leader read Signed-off-by: you06 <you1474600@gmail.com> * address comment Signed-off-by: you06 <you1474600@gmail.com> * trigger CI Signed-off-by: you06 <you1474600@gmail.com> --------- Signed-off-by: you06 <you1474600@gmail.com> --------- Signed-off-by: you06 <you1474600@gmail.com>
Ref pingcap/tidb#43659
Remove the stale-read flag after resolving lock.
Before this PR:
After this PR:
Because the request struct is reused when retrying in get, it'll suffer not leader error, because the stale read field is already reset from the context patcher. But the request is regenerated in batch get, so it'll meet data is not ready instead. For both cases, this PR reduces unnecessary RPC.