Skip to content

Commit

Permalink
Lightning: increase backoff if split fails (#49518) (#51929)
Browse files Browse the repository at this point in the history
close #49517
  • Loading branch information
ti-chi-bot authored May 10, 2024
1 parent 99f4d94 commit 5678c38
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions br/pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 {
Expand Down

0 comments on commit 5678c38

Please sign in to comment.