diff --git a/pkg/lightning/backend/local/local.go b/pkg/lightning/backend/local/local.go index f5db98aeb..ef85fb6d0 100644 --- a/pkg/lightning/backend/local/local.go +++ b/pkg/lightning/backend/local/local.go @@ -983,12 +983,29 @@ func (local *local) checkMultiIngestSupport(ctx context.Context, pdCtl *pdutil.P return errors.Trace(err) } for _, s := range stores { - client, err := local.getImportClient(ctx, s.Id) - if err != nil { - return errors.Trace(err) + // only check up stores + if s.State != metapb.StoreState_Up { + continue } - _, err = client.MultiIngest(ctx, &sst.MultiIngestRequest{}) - if err != nil { + var err error + for i := 0; i < maxRetryTimes; i++ { + if i > 0 { + select { + case <-time.After(100 * time.Millisecond): + case <-ctx.Done(): + return ctx.Err() + } + } + client, err1 := local.getImportClient(ctx, s.Id) + if err1 != nil { + err = err1 + log.L().Warn("get import client failed", zap.Error(err), zap.String("store", s.Address)) + continue + } + _, err = client.MultiIngest(ctx, &sst.MultiIngestRequest{}) + if err == nil { + break + } if st, ok := status.FromError(err); ok { if st.Code() == codes.Unimplemented { log.L().Info("multi ingest not support", zap.Any("unsupported store", s)) @@ -996,7 +1013,13 @@ func (local *local) checkMultiIngestSupport(ctx context.Context, pdCtl *pdutil.P return nil } } - return errors.Trace(err) + log.L().Warn("check multi ingest support failed", zap.Error(err), zap.String("store", s.Address), + zap.Int("retry", i)) + } + if err != nil { + log.L().Warn("check multi failed all retry, fallback to false", log.ShortError(err)) + local.supportMultiIngest = false + return nil } }