store: the peer id mismatch is not handled #45297
Labels
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
severity/major
sig/transaction
SIG:Transaction
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Consider such a case:
There's a region with initial peers "1, 2, 3", and later region configuration has changed, for example:
store_id
is 3,region_id
is 0 andpeer_id
is 3 still exists.AccessFollower
is used by the replica selector to decide the target peer for example when stale read is used.5
and stale read retry happens.2. What did you expect to see? (Required)
The region cache is refreshed as expected.
3. What did you see instead (Required)
After
RegionError
is received by thekv-client
, the bottom retry keeps happening and there's no chance to rerefresh to invalidate the region cache, thus there are quite a lot of retry and keep encounteringpeer is mismatch
region errors.The cause is possibly that:
peer id mismatch
is not processed, the replica selector would always retry.leaderOnly
flag is set, all the checks are bypassed so theconst maxReplicaAttempt = 10
dose not work either.To fix this issue, it's needed to:
peer id mismatch
error properly and ensure the region cache is invalidated.leaderOnly
flag is set, ensure the necessary limit takes effect for example theconst maxReplicaAttempt = 10
. Acually this part code is complex and need careful handling.4. What is your TiDB version? (Required)
v6.5.3
The text was updated successfully, but these errors were encountered: