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) (#28138)
  • Loading branch information
ti-srebot authored Dec 17, 2021
1 parent f8db963 commit 50c26c1
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 @@ -155,7 +155,11 @@ func balanceBatchCopTask(ctx context.Context, kvStore *tikv.KVStore, originalTas
}, 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 50c26c1

Please sign in to comment.