Skip to content

Commit

Permalink
build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
mittalrishabh committed Nov 26, 2024
1 parent 0832080 commit 6b4a6b5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions internal/locate/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,6 @@ func (state *tryFollower) next(bo *retry.Backoffer, selector *replicaSelector) (
rpcCtx.contextPatcher.replicaRead = &replicaRead
}
leader := selector.replicas[state.leaderIdx]
leaderTimeout := leader.deadlineErrUsingConfTimeout
if(leader.deadlineErrUsingConfTimeout || leader.serverIsBusy) {
rpcCtx.contextPatcher.staleRead = &state.isStaleRead
} else {
Expand Down Expand Up @@ -1233,6 +1232,16 @@ func (s *replicaSelector) onReadReqConfigurableTimeout(req *tikvrpc.Request) boo
}
}

func (s *replicaSelector) onServerIsBusy(req *tikvrpc.Request) {
switch req.Type {
case tikvrpc.CmdGet, tikvrpc.CmdBatchGet, tikvrpc.CmdScan,
tikvrpc.CmdCop, tikvrpc.CmdBatchCop, tikvrpc.CmdCopStream:
if target := s.targetReplica(); target != nil {
target.serverIsBusy = true
}
}
}

func (s *replicaSelector) checkLiveness(bo *retry.Backoffer, accessReplica *replica) livenessState {
store := accessReplica.store
liveness := store.requestLiveness(bo, s.regionCache)
Expand Down Expand Up @@ -2137,8 +2146,8 @@ func (s *RegionRequestSender) onRegionError(bo *retry.Backoffer, ctx *RPCContext
if s.replicaSelector.onReadReqConfigurableTimeout(req) {
return true, nil
}
} else if s.target != nil {
s.target.serverIsBusy = true
} else if s.replicaSelector != nil {
s.replicaSelector.onServerIsBusy(req)
}
logutil.Logger(bo.GetCtx()).Debug(
"tikv reports `ServerIsBusy` retry later",
Expand Down

0 comments on commit 6b4a6b5

Please sign in to comment.