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 2 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: 10 additions & 1 deletion br/pkg/storage/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ package storage

import (
"context"
"strings"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/tidb/sessionctx/variable"
)

Expand All @@ -18,12 +21,18 @@ func ValidateCloudStorageURI(ctx context.Context, uri string) error {
if err != nil {
return err
}
_, err = New(ctx, b, &ExternalStorageOptions{
vCtx, cancel := context.WithDeadline(
ctx, time.Now().Add(5*time.Second))
_, err = New(vCtx, b, &ExternalStorageOptions{
CheckPermissions: []Permission{
ListObjects,
GetObject,
AccessBuckets,
},
})
cancel()
if strings.Contains(err.Error(), "context deadline exceeded") {
return errors.New("validate cloud storage uri timeout")
}
return err
}
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)
if err != nil {
return nil, errors.Trace(err)
Expand Down
Loading