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

br: stop s3 retryer when connection is refused #46938

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions br/pkg/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,10 @@ func isConnectionResetError(err error) bool {
return strings.Contains(err.Error(), "read: connection reset")
}

func isConnectionRefusedError(err error) bool {
return strings.Contains(err.Error(), "connection refused")
}

func (rl retryerWithLog) ShouldRetry(r *request.Request) bool {
// for unit test
failpoint.Inject("replace-error-to-connection-reset-by-peer", func(_ failpoint.Value) {
Expand All @@ -1024,6 +1028,9 @@ func (rl retryerWithLog) ShouldRetry(r *request.Request) bool {
if isConnectionResetError(r.Error) {
return true
}
if isConnectionRefusedError(r.Error) {
return false
}
if isDeadlineExceedError(r.Error) && r.HTTPRequest.URL.Host == ec2MetaAddress {
// fast fail for unreachable linklocal address in EC2 containers.
log.Warn("failed to get EC2 metadata. skipping.", logutil.ShortError(r.Error))
Expand Down
2 changes: 2 additions & 0 deletions ddl/stage_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func NewBackfillSchedulerHandle(ctx context.Context, taskMeta []byte, d *ddl,
return nil, errors.New("index info not found")
}

// Unregister the previous BackendCtx if possible because the context has been changed.
ingest.LitBackCtxMgr.Unregister(jobMeta.ID)
bc, err := ingest.LitBackCtxMgr.Register(ctx, indexInfo.Unique, jobMeta.ID, d.etcdCli, jobMeta.ReorgMeta.ResourceGroupName)
if err != nil {
return nil, errors.Trace(err)
Expand Down