diff --git a/br/pkg/lightning/backend/local/local.go b/br/pkg/lightning/backend/local/local.go index 36377e7dcfd98..cca73bb4a806a 100644 --- a/br/pkg/lightning/backend/local/local.go +++ b/br/pkg/lightning/backend/local/local.go @@ -1129,6 +1129,8 @@ func (local *Backend) prepareAndSendJob( needSplit = true }) logger := log.FromContext(ctx).With(zap.String("uuid", engine.ID())).Begin(zap.InfoLevel, "split and scatter ranges") + backOffTime := 10 * time.Second + maxbackoffTime := 120 * time.Second for i := 0; i < maxRetryTimes; i++ { failpoint.Inject("skipSplitAndScatter", func() { failpoint.Break() @@ -1141,6 +1143,15 @@ func (local *Backend) prepareAndSendJob( log.FromContext(ctx).Warn("split and scatter failed in retry", zap.String("engine ID", engine.ID()), log.ShortError(err), zap.Int("retry", i)) + select { + case <-time.After(backOffTime): + case <-ctx.Done(): + return ctx.Err() + } + backOffTime *= 2 + if backOffTime > maxbackoffTime { + backOffTime = maxbackoffTime + } } logger.End(zap.ErrorLevel, err) if err != nil {