Skip to content

Commit

Permalink
Revert "*: disable SSL when the s3 endpoint is self managed"
Browse files Browse the repository at this point in the history
This reverts commit 1784b5f.
  • Loading branch information
lance6716 committed Nov 8, 2023
1 parent 73afea0 commit 04c9f59
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 46 deletions.
9 changes: 1 addition & 8 deletions br/pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import (
"github.com/pingcap/tidb/pkg/tablecodec"
"github.com/pingcap/tidb/pkg/util/codec"
"github.com/pingcap/tidb/pkg/util/engine"
"github.com/pingcap/tidb/pkg/util/intest"
"github.com/tikv/client-go/v2/oracle"
tikvclient "github.com/tikv/client-go/v2/tikv"
pd "github.com/tikv/pd/client"
Expand Down Expand Up @@ -949,13 +948,7 @@ func (local *Backend) CloseEngine(ctx context.Context, cfg *backend.EngineConfig
if err != nil {
return err
}
opts := &storage.ExternalStorageOptions{
DisableSSL: true,
}
if intest.InTest {
opts.NoCredentials = true
}
store, err := storage.New(ctx, storeBackend, opts)
store, err := storage.NewWithDefaultOpt(ctx, storeBackend)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion br/pkg/storage/ks3.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func NewKS3Storage(
return nil, errors.New("ks3 region is empty")
}
awsConfig.Region = qs.Region
awsConfig.DisableSSL = opts.DisableSSL

if qs.Endpoint != "" {
awsConfig.Endpoint = qs.Endpoint
Expand Down
1 change: 0 additions & 1 deletion br/pkg/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ func NewS3Storage(ctx context.Context, backend *backuppb.S3, opts *ExternalStora
} else {
awsConfig.WithRegion(qs.Region)
}
awsConfig.DisableSSL = aws.Bool(opts.DisableSSL)

if opts.S3Retryer != nil {
request.WithRetryer(awsConfig, opts.S3Retryer)
Expand Down
4 changes: 0 additions & 4 deletions br/pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ type ExternalStorageOptions struct {
// CheckObjectLockOptions check the s3 bucket has enabled the ObjectLock.
// if enabled. it will send the options to tikv.
CheckS3ObjectLockOptions bool

// DisableSSL disable the SSL when connect to the remote storage. Currently
// only S3 is supported.
DisableSSL bool
}

// Create creates ExternalStorage.
Expand Down
4 changes: 1 addition & 3 deletions pkg/ddl/backfilling_merge_sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ func (m *mergeSortExecutor) RunSubtask(ctx context.Context, subtask *proto.Subta
if err != nil {
return err
}
opt := &storage.ExternalStorageOptions{
DisableSSL: true,
}
opt := &storage.ExternalStorageOptions{}
if intest.InTest {
opt.NoCredentials = true
}
Expand Down
9 changes: 1 addition & 8 deletions pkg/ddl/backfilling_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
"github.com/pingcap/tidb/pkg/tablecodec"
tidbutil "github.com/pingcap/tidb/pkg/util"
"github.com/pingcap/tidb/pkg/util/chunk"
"github.com/pingcap/tidb/pkg/util/intest"
"github.com/pingcap/tidb/pkg/util/logutil"
"github.com/pingcap/tidb/pkg/util/memory"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -193,13 +192,7 @@ func NewWriteIndexToExternalStoragePipeline(
if err != nil {
return nil, err
}
opts := &storage.ExternalStorageOptions{
DisableSSL: true,
}
if intest.InTest {
opts.NoCredentials = true
}
extStore, err := storage.New(ctx, backend, opts)
extStore, err := storage.NewWithDefaultOpt(ctx, backend)
if err != nil {
return nil, err
}
Expand Down
22 changes: 1 addition & 21 deletions pkg/executor/importer/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,34 +931,14 @@ func (e *LoadDataController) InitDataStore(ctx context.Context) error {
return exeerrors.ErrLoadDataInvalidURI.GenWithStackByArgs(target,
err3.Error())
}
s, err = e.initSelfManagedExternalStore(ctx, cloudStorageURL, target)
s, err = e.initExternalStore(ctx, cloudStorageURL, target)
if err != nil {
return err
}
e.GlobalSortStore = s
}
return nil
}

func (*LoadDataController) initSelfManagedExternalStore(ctx context.Context, u *url.URL, target string) (storage.ExternalStorage, error) {
b, err2 := storage.ParseBackendFromURL(u, nil)
if err2 != nil {
return nil, exeerrors.ErrLoadDataInvalidURI.GenWithStackByArgs(target, GetMsgFromBRError(err2))
}

opt := &storage.ExternalStorageOptions{
DisableSSL: true,
}
if intest.InTest {
opt.NoCredentials = true
}
s, err := storage.New(ctx, b, opt)
if err != nil {
return nil, exeerrors.ErrLoadDataCantAccess.GenWithStackByArgs(target, GetMsgFromBRError(err))
}
return s, nil
}

func (*LoadDataController) initExternalStore(ctx context.Context, u *url.URL, target string) (storage.ExternalStorage, error) {
b, err2 := storage.ParseBackendFromURL(u, nil)
if err2 != nil {
Expand Down

0 comments on commit 04c9f59

Please sign in to comment.