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: not use the custom http client for gcs (#47026) #47058

Merged
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions br/pkg/storage/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ func NewGCSStorage(ctx context.Context, gcs *backuppb.GCS, opts *ExternalStorage
if gcs.Endpoint != "" {
clientOps = append(clientOps, option.WithEndpoint(gcs.Endpoint))
}
// the HTTPClient should has credential, currently the HTTPClient only has the http.Transport.
// So we remove the HTTPClient in the storage.New().
// Issue: https: //github.com/pingcap/tidb/issues/47022
if opts.HTTPClient != nil {
clientOps = append(clientOps, option.WithHTTPClient(opts.HTTPClient))
}
Expand Down
7 changes: 6 additions & 1 deletion br/pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ type ExternalStorageOptions struct {
NoCredentials bool

// HTTPClient to use. The created storage may ignore this field if it is not
// directly using HTTP (e.g. the local storage).
// directly using HTTP (e.g. the local storage) or use self-design HTTP client
// with credential (e.g. the gcs).
// NOTICE: the HTTPClient is only used by s3 storage and azure blob storage.
HTTPClient *http.Client

// CheckPermissions check the given permission in New() function.
Expand Down Expand Up @@ -185,6 +187,9 @@ func New(ctx context.Context, backend *backuppb.StorageBackend, opts *ExternalSt
if backend.Gcs == nil {
return nil, errors.Annotate(berrors.ErrStorageInvalidConfig, "GCS config not found")
}
// the HTTPClient should has credential, currently the HTTPClient only has the http.Transport.
// Issue: https: //github.com/pingcap/tidb/issues/47022
opts.HTTPClient = nil
return NewGCSStorage(ctx, backend.Gcs, opts)
case *backuppb.StorageBackend_AzureBlobStorage:
return newAzureBlobStorage(ctx, backend.AzureBlobStorage, opts)
Expand Down
Loading