Skip to content

Commit

Permalink
bugfix: fix invalid nil pointer when trying to record Store.SlownessS…
Browse files Browse the repository at this point in the history
…tat. (#1017) (#1074)

* bugfix: fix invalid nil pointer when trying to record Store.SlownessStat.



* Polish codes.



* Polish comments.



---------

Signed-off-by: lucasliang <[email protected]>
Co-authored-by: lucasliang <[email protected]>
  • Loading branch information
crazycs520 and LykxSassinator authored Dec 8, 2023
1 parent 7e4c809 commit 106bf19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/locate/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -1616,8 +1616,8 @@ func (s *RegionRequestSender) sendReqToRegion(
if !injectFailOnSend {
start := time.Now()
resp, err = s.client.SendRequest(ctx, sendToAddr, req, timeout)
// Record timecost of external requests on related Store when ReplicaReadMode == PreferLeader.
if req.ReplicaReadType == kv.ReplicaReadPreferLeader && !util.IsInternalRequest(req.RequestSource) {
// Record timecost of external requests on related Store when `ReplicaReadMode == "PreferLeader"`.
if rpcCtx.Store != nil && req.ReplicaReadType == kv.ReplicaReadPreferLeader && !util.IsInternalRequest(req.RequestSource) {
rpcCtx.Store.recordSlowScoreStat(time.Since(start))
}
if s.Stats != nil {
Expand Down

0 comments on commit 106bf19

Please sign in to comment.