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)

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

Signed-off-by: lucasliang <[email protected]>

* Polish codes.

Signed-off-by: lucasliang <[email protected]>

* Polish comments.

Signed-off-by: lucasliang <[email protected]>

---------

Signed-off-by: lucasliang <[email protected]>
  • Loading branch information
LykxSassinator authored Oct 16, 2023
1 parent 07432ef commit e70513e
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 @@ -1679,8 +1679,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 e70513e

Please sign in to comment.