Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightning: increase backoff if split fails (#49518) #56874

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1086,6 +1086,8 @@
needSplit = true
})
logger := log.FromContext(ctx).With(zap.Stringer("uuid", engine.UUID)).Begin(zap.InfoLevel, "split and scatter ranges")
backOffTime := 10 * time.Second

Check warning on line 1089 in br/pkg/lightning/backend/local/local.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/backend/local/local.go#L1089

Added line #L1089 was not covered by tests
maxbackoffTime := 120 * time.Second
for i := 0; i < maxRetryTimes; i++ {
failpoint.Inject("skipSplitAndScatter", func() {
failpoint.Break()
Expand All @@ -1098,6 +1100,15 @@

log.FromContext(ctx).Warn("split and scatter failed in retry", zap.Stringer("uuid", engine.UUID),
log.ShortError(err), zap.Int("retry", i))
select {
case <-time.After(backOffTime):
case <-ctx.Done():
return ctx.Err()
}
backOffTime *= 2

Check warning on line 1108 in br/pkg/lightning/backend/local/local.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/backend/local/local.go#L1103-L1108

Added lines #L1103 - L1108 were not covered by tests
if backOffTime > maxbackoffTime {
backOffTime = maxbackoffTime
}

Check warning on line 1111 in br/pkg/lightning/backend/local/local.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/backend/local/local.go#L1110-L1111

Added lines #L1110 - L1111 were not covered by tests
}
logger.End(zap.ErrorLevel, err)
if err != nil {
Expand Down