Skip to content

Commit

Permalink
copr: avoid NPE when store is not available when balance batch cop ta…
Browse files Browse the repository at this point in the history
…sk (#28110)
  • Loading branch information
windtalker authored Sep 17, 2021
1 parent 9b0604b commit c6dfd70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion store/copr/batch_coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ func balanceBatchCopTask(ctx context.Context, kvStore *kvStore, originalTasks []
}, 2*time.Second)

if err != nil || !resp.Resp.(*mpp.IsAliveResponse).Available {
logutil.BgLogger().Warn("Cannot detect store's availability", zap.String("store address", s.GetAddr()), zap.String("err message", err.Error()))
errMsg := "store not ready to serve"
if err != nil {
errMsg = err.Error()
}
logutil.BgLogger().Warn("Store is not ready", zap.String("store address", s.GetAddr()), zap.String("err message", errMsg))
mu.Lock()
mppStoreLastFailTime[s.GetAddr()] = time.Now()
mu.Unlock()
Expand Down

0 comments on commit c6dfd70

Please sign in to comment.