diff --git a/br/pkg/backup/client.go b/br/pkg/backup/client.go index 927f3937963a0..daac9609ae5f4 100644 --- a/br/pkg/backup/client.go +++ b/br/pkg/backup/client.go @@ -556,7 +556,7 @@ func BuildBackupRangeAndSchema( continue } - logger := log.With( + logger := log.L().With( zap.String("db", dbInfo.Name.O), zap.String("table", tableInfo.Name.O), ) diff --git a/br/pkg/backup/schema.go b/br/pkg/backup/schema.go index bb0cf7f884189..f42976272ea54 100644 --- a/br/pkg/backup/schema.go +++ b/br/pkg/backup/schema.go @@ -117,7 +117,7 @@ func (ss *Schemas) BackupSchemas( } workerPool.ApplyOnErrorGroup(errg, func() error { if schema.tableInfo != nil { - logger := log.With( + logger := log.L().With( zap.String("db", schema.dbInfo.Name.O), zap.String("table", schema.tableInfo.Name.O), ) diff --git a/br/pkg/lightning/backend/local/BUILD.bazel b/br/pkg/lightning/backend/local/BUILD.bazel index 9524ab5febc2b..b09a1abad85ba 100644 --- a/br/pkg/lightning/backend/local/BUILD.bazel +++ b/br/pkg/lightning/backend/local/BUILD.bazel @@ -69,6 +69,7 @@ go_library( "@org_golang_google_grpc//backoff", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//keepalive", "@org_golang_google_grpc//status", "@org_golang_x_exp//slices", diff --git a/br/pkg/lightning/backend/local/local.go b/br/pkg/lightning/backend/local/local.go index 4f8ca6bf3117a..11264031321a0 100644 --- a/br/pkg/lightning/backend/local/local.go +++ b/br/pkg/lightning/backend/local/local.go @@ -75,6 +75,7 @@ import ( "google.golang.org/grpc/backoff" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/status" ) @@ -148,7 +149,7 @@ func (f *importClientFactoryImpl) makeConn(ctx context.Context, storeID uint64) if err != nil { return nil, errors.Trace(err) } - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) if f.tls.TLSConfig() != nil { opt = grpc.WithTransportCredentials(credentials.NewTLS(f.tls.TLSConfig())) } diff --git a/br/pkg/lightning/common/BUILD.bazel b/br/pkg/lightning/common/BUILD.bazel index a5245356b2715..bc04df82904a9 100644 --- a/br/pkg/lightning/common/BUILD.bazel +++ b/br/pkg/lightning/common/BUILD.bazel @@ -33,6 +33,7 @@ go_library( "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//status", "@org_golang_x_sys//unix", "@org_uber_go_zap//:zap", diff --git a/br/pkg/lightning/common/security.go b/br/pkg/lightning/common/security.go index a48abc48c2c54..8d0c98223d18a 100644 --- a/br/pkg/lightning/common/security.go +++ b/br/pkg/lightning/common/security.go @@ -28,6 +28,7 @@ import ( pd "github.com/tikv/pd/client" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) type TLS struct { @@ -104,7 +105,7 @@ func (tc *TLS) ToGRPCDialOption() grpc.DialOption { if tc.inner != nil { return grpc.WithTransportCredentials(credentials.NewTLS(tc.inner)) } - return grpc.WithInsecure() + return grpc.WithTransportCredentials(insecure.NewCredentials()) } // WrapListener places a TLS layer on top of the existing listener. diff --git a/br/pkg/logutil/rate.go b/br/pkg/logutil/rate.go index 12ef85732efd7..e3e67ed241bff 100644 --- a/br/pkg/logutil/rate.go +++ b/br/pkg/logutil/rate.go @@ -51,5 +51,5 @@ func (r *RateTracer) RateAt(instant time.Time) float64 { // L make a logger with the current speed. func (r *RateTracer) L() *zap.Logger { - return log.With(zap.String("speed", fmt.Sprintf("%.2f ops/s", r.Rate()))) + return log.L().With(zap.String("speed", fmt.Sprintf("%.2f ops/s", r.Rate()))) } diff --git a/br/pkg/restore/BUILD.bazel b/br/pkg/restore/BUILD.bazel index d4f70e278fd2c..35bed1951e9b3 100644 --- a/br/pkg/restore/BUILD.bazel +++ b/br/pkg/restore/BUILD.bazel @@ -88,6 +88,7 @@ go_library( "@org_golang_google_grpc//backoff", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//keepalive", "@org_golang_google_grpc//status", "@org_golang_x_exp//slices", diff --git a/br/pkg/restore/client.go b/br/pkg/restore/client.go index c0f58817ec0af..18a3dc61879e4 100644 --- a/br/pkg/restore/client.go +++ b/br/pkg/restore/client.go @@ -64,6 +64,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" ) @@ -1298,7 +1299,7 @@ func (rc *Client) switchTiKVMode(ctx context.Context, mode import_sstpb.SwitchMo finalStore := store rc.workerPool.ApplyOnErrorGroup(eg, func() error { - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) if rc.tlsConf != nil { opt = grpc.WithTransportCredentials(credentials.NewTLS(rc.tlsConf)) } @@ -1410,7 +1411,7 @@ func (rc *Client) execChecksum( concurrency uint, loadStatCh chan<- *CreatedTable, ) error { - logger := log.With( + logger := log.L().With( zap.String("db", tbl.OldTable.DB.Name.O), zap.String("table", tbl.OldTable.Info.Name.O), ) diff --git a/br/pkg/restore/import.go b/br/pkg/restore/import.go index 5004639c1a00d..34da5cbea2404 100644 --- a/br/pkg/restore/import.go +++ b/br/pkg/restore/import.go @@ -38,6 +38,7 @@ import ( "google.golang.org/grpc/backoff" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/status" ) @@ -197,7 +198,7 @@ func (ic *importClient) GetImportClient( if err != nil { return nil, errors.Trace(err) } - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) if ic.tlsConf != nil { opt = grpc.WithTransportCredentials(credentials.NewTLS(ic.tlsConf)) } diff --git a/br/pkg/restore/split/BUILD.bazel b/br/pkg/restore/split/BUILD.bazel index ac9eb50eb4d20..1726817092ba8 100644 --- a/br/pkg/restore/split/BUILD.bazel +++ b/br/pkg/restore/split/BUILD.bazel @@ -32,6 +32,7 @@ go_library( "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//status", "@org_uber_go_multierr//:multierr", "@org_uber_go_zap//:zap", diff --git a/br/pkg/restore/split/client.go b/br/pkg/restore/split/client.go index fb82135ae2af6..5f6788d6ee470 100644 --- a/br/pkg/restore/split/client.go +++ b/br/pkg/restore/split/client.go @@ -35,6 +35,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" ) @@ -200,7 +201,7 @@ func (c *pdClient) SplitRegion(ctx context.Context, regionInfo *RegionInfo, key if err != nil { return nil, errors.Trace(err) } - conn, err := grpc.Dial(store.GetAddress(), grpc.WithInsecure()) + conn, err := grpc.Dial(store.GetAddress(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, errors.Trace(err) } @@ -336,7 +337,7 @@ func sendSplitRegionRequest(ctx context.Context, c *pdClient, regionInfo *Region if err != nil { return false, nil, err } - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) if c.tlsConf != nil { opt = grpc.WithTransportCredentials(credentials.NewTLS(c.tlsConf)) } diff --git a/br/pkg/utils/BUILD.bazel b/br/pkg/utils/BUILD.bazel index 1cad8d5628dee..323b126eb5c6b 100644 --- a/br/pkg/utils/BUILD.bazel +++ b/br/pkg/utils/BUILD.bazel @@ -51,6 +51,7 @@ go_library( "@org_golang_google_grpc//backoff", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//keepalive", "@org_golang_google_grpc//status", "@org_golang_x_net//http/httpproxy", diff --git a/br/pkg/utils/misc.go b/br/pkg/utils/misc.go index 8078802b2e055..ab62a7b7db534 100644 --- a/br/pkg/utils/misc.go +++ b/br/pkg/utils/misc.go @@ -23,6 +23,7 @@ import ( "github.com/pingcap/tidb/parser/types" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) // IsTypeCompatible checks whether type target is compatible with type src @@ -84,7 +85,7 @@ func IsTypeCompatible(src types.FieldType, target types.FieldType) bool { } func GRPCConn(ctx context.Context, storeAddr string, tlsConf *tls.Config, opts ...grpc.DialOption) (*grpc.ClientConn, error) { - secureOpt := grpc.WithInsecure() + secureOpt := grpc.WithTransportCredentials(insecure.NewCredentials()) if tlsConf != nil { secureOpt = grpc.WithTransportCredentials(credentials.NewTLS(tlsConf)) } diff --git a/br/pkg/utils/store_manager.go b/br/pkg/utils/store_manager.go index 8dd50a2a57c82..8a89e49022806 100644 --- a/br/pkg/utils/store_manager.go +++ b/br/pkg/utils/store_manager.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" ) @@ -136,7 +137,7 @@ func (mgr *StoreManager) getGrpcConnLocked(ctx context.Context, storeID uint64) if err != nil { return nil, errors.Trace(err) } - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) if mgr.tlsConf != nil { opt = grpc.WithTransportCredentials(credentials.NewTLS(mgr.tlsConf)) } diff --git a/build/nogo_config.json b/build/nogo_config.json index 97a1a1feed50e..0aa1bd67a2217 100644 --- a/build/nogo_config.json +++ b/build/nogo_config.json @@ -750,26 +750,27 @@ "/build/": "no need to linter code", "/external/": "no need to vet third party code", ".*_generated\\.go$": "ignore generated code", - ".*_test\\.go$": "ignore test code" + ".*_test\\.go$": "ignore test code", + "br/pkg/restore/split/client.go": "github.com/golang/protobuf deprecated", + "br/pkg/streamhelper/advancer_cliext.go": "github.com/golang/protobuf deprecated", + "br/pkg/lightning/checkpoints/checkpoints.go": "cfg.TikvImporter.Addr is deprecated", + "br/pkg/lightning/checkpoints/glue_checkpoint.go": "cfg.TikvImporter.Addr is deprecated" }, "only_files": { "util/gctuner": "util/gctuner", "util/cgroup": "util/cgroup code", "util/watcher": "util/watcher", - "br/pkg/lightning/restore/": "br/pkg/lightning/restore/", - "br/pkg/lightning/mydump/": "br/pkg/lightning/mydump/", + "br/pkg/": "br/pkg", "executor/aggregate.go": "executor/aggregate.go", - "types/json_binary_functions.go": "types/json_binary_functions.go", - "types/json_binary_test.go": "types/json_binary_test.go", + "types/": "types", "ddl/": "enable to ddl", "expression/builtin_cast.go": "enable expression/builtin_cast.go", "planner/core/plan.go": "planner/core/plan.go", - "server/conn.go": "server/conn.go", - "server/conn_stmt.go": "server/conn_stmt.go", - "server/conn_test.go": "server/conn_test.go", "extension/": "extension code", "resourcemanager/": "resourcemanager code", - "keyspace/": "keyspace code" + "keyspace/": "keyspace code", + "server/": "server code", + "meta": "meta code" } }, "SA2000": { diff --git a/executor/BUILD.bazel b/executor/BUILD.bazel index 35703034b1214..8b0e824288c99 100644 --- a/executor/BUILD.bazel +++ b/executor/BUILD.bazel @@ -239,6 +239,7 @@ go_library( "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//status", "@org_golang_x_exp//slices", "@org_golang_x_sync//errgroup", diff --git a/executor/load_stats.go b/executor/load_stats.go index d59651e29200a..e292eb817519d 100644 --- a/executor/load_stats.go +++ b/executor/load_stats.go @@ -52,7 +52,7 @@ func (k loadStatsVarKeyType) String() string { const LoadStatsVarKey loadStatsVarKeyType = 0 // Next implements the Executor Next interface. -func (e *LoadStatsExec) Next(ctx context.Context, req *chunk.Chunk) error { +func (e *LoadStatsExec) Next(_ context.Context, req *chunk.Chunk) error { req.GrowAndReset(e.maxChunkSize) if len(e.info.Path) == 0 { return errors.New("Load Stats: file path is empty") @@ -72,7 +72,7 @@ func (e *LoadStatsExec) Close() error { } // Open implements the Executor Open interface. -func (e *LoadStatsExec) Open(ctx context.Context) error { +func (e *LoadStatsExec) Open(_ context.Context) error { return nil } diff --git a/executor/lock_stats.go b/executor/lock_stats.go index 540670e8119fc..ccf6df123db07 100644 --- a/executor/lock_stats.go +++ b/executor/lock_stats.go @@ -44,7 +44,7 @@ func (k lockStatsVarKeyType) String() string { const LockStatsVarKey lockStatsVarKeyType = 0 // Next implements the Executor Next interface. -func (e *LockStatsExec) Next(ctx context.Context, req *chunk.Chunk) error { +func (e *LockStatsExec) Next(_ context.Context, _ *chunk.Chunk) error { do := domain.GetDomain(e.ctx) is := do.InfoSchema() h := do.StatsHandle() @@ -87,7 +87,7 @@ func (e *LockStatsExec) Close() error { } // Open implements the Executor Open interface. -func (e *LockStatsExec) Open(ctx context.Context) error { +func (e *LockStatsExec) Open(_ context.Context) error { return nil } @@ -109,7 +109,7 @@ func (k unlockStatsVarKeyType) String() string { const UnlockStatsVarKey unlockStatsVarKeyType = 0 // Next implements the Executor Next interface. -func (e *UnlockStatsExec) Next(ctx context.Context, req *chunk.Chunk) error { +func (e *UnlockStatsExec) Next(_ context.Context, _ *chunk.Chunk) error { do := domain.GetDomain(e.ctx) is := do.InfoSchema() h := do.StatsHandle() @@ -152,6 +152,6 @@ func (e *UnlockStatsExec) Close() error { } // Open implements the Executor Open interface. -func (e *UnlockStatsExec) Open(ctx context.Context) error { +func (e *UnlockStatsExec) Open(_ context.Context) error { return nil } diff --git a/executor/memtable_reader.go b/executor/memtable_reader.go index 3c1530ed714cf..a299438da0777 100644 --- a/executor/memtable_reader.go +++ b/executor/memtable_reader.go @@ -49,6 +49,7 @@ import ( "golang.org/x/exp/slices" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) const clusterLogBatchSize = 256 @@ -431,7 +432,7 @@ func (e *clusterLogRetriever) startRetrieving( serversInfo []infoschema.ServerInfo, req *diagnosticspb.SearchLogRequest) ([]chan logStreamResult, error) { // gRPC options - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) security := config.GetGlobalConfig().Security if len(security.ClusterSSLCA) != 0 { clusterSecurity := security.ClusterSecurity() diff --git a/infoschema/BUILD.bazel b/infoschema/BUILD.bazel index a92608a8df1b3..f827394be7904 100644 --- a/infoschema/BUILD.bazel +++ b/infoschema/BUILD.bazel @@ -56,6 +56,7 @@ go_library( "@com_github_tikv_client_go_v2//tikv", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_x_exp//slices", "@org_uber_go_zap//:zap", ], diff --git a/infoschema/tables.go b/infoschema/tables.go index 4d7ba5bb3a11d..728b8cf1aa5a5 100644 --- a/infoschema/tables.go +++ b/infoschema/tables.go @@ -58,6 +58,7 @@ import ( "golang.org/x/exp/slices" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) const ( @@ -2333,7 +2334,7 @@ func serverInfoItemToRows(items []*diagnosticspb.ServerInfoItem, tp, addr string } func getServerInfoByGRPC(ctx context.Context, address string, tp diagnosticspb.ServerInfoType) ([]*diagnosticspb.ServerInfoItem, error) { - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) security := config.GetGlobalConfig().Security if len(security.ClusterSSLCA) != 0 { clusterSecurity := security.ClusterSecurity() diff --git a/meta/autoid/BUILD.bazel b/meta/autoid/BUILD.bazel index b67f7f7c223c7..d6bcc1ef94689 100644 --- a/meta/autoid/BUILD.bazel +++ b/meta/autoid/BUILD.bazel @@ -32,6 +32,7 @@ go_library( "@io_etcd_go_etcd_client_v3//:client", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_uber_go_zap//:zap", ], ) diff --git a/meta/autoid/autoid_service.go b/meta/autoid/autoid_service.go index 0b0f4946b3d0c..314ac3beef679 100644 --- a/meta/autoid/autoid_service.go +++ b/meta/autoid/autoid_service.go @@ -30,6 +30,7 @@ import ( "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) var _ Allocator = &singlePointAlloc{} @@ -83,7 +84,7 @@ func (d *clientDiscover) GetClient(ctx context.Context) (autoid.AutoIDAllocClien } addr := string(resp.Kvs[0].Value) - opt := grpc.WithInsecure() + opt := grpc.WithTransportCredentials(insecure.NewCredentials()) security := config.GetGlobalConfig().Security if len(security.ClusterSSLCA) != 0 { clusterSecurity := security.ClusterSecurity() diff --git a/server/plan_replayer.go b/server/plan_replayer.go index 30f7c4ae821c1..d5265a21e7939 100644 --- a/server/plan_replayer.go +++ b/server/plan_replayer.go @@ -276,7 +276,7 @@ func loadSQLMetaFile(z *zip.Reader) (uint64, error) { } //nolint: errcheck,all_revive defer v.Close() - _, err = toml.DecodeReader(v, &varMap) + _, err = toml.NewDecoder(v).Decode(&varMap) if err != nil { return 0, errors.AddStack(err) } diff --git a/sessionctx/binloginfo/BUILD.bazel b/sessionctx/binloginfo/BUILD.bazel index 7a843495273ea..3c345cd043469 100644 --- a/sessionctx/binloginfo/BUILD.bazel +++ b/sessionctx/binloginfo/BUILD.bazel @@ -54,6 +54,7 @@ go_test( "@com_github_pingcap_tipb//go-binlog", "@com_github_stretchr_testify//require", "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//credentials/insecure", "@org_uber_go_goleak//:goleak", ], ) diff --git a/sessionctx/binloginfo/binloginfo_test.go b/sessionctx/binloginfo/binloginfo_test.go index 28235b5184b68..f6ca6bc059db8 100644 --- a/sessionctx/binloginfo/binloginfo_test.go +++ b/sessionctx/binloginfo/binloginfo_test.go @@ -45,6 +45,7 @@ import ( "github.com/pingcap/tipb/go-binlog" "github.com/stretchr/testify/require" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) type mockBinlogPump struct { @@ -100,7 +101,7 @@ func createBinlogSuite(t *testing.T) (s *binlogSuite) { opt := grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { return net.DialTimeout("unix", addr, timeout) }) - clientCon, err := grpc.Dial(unixFile, opt, grpc.WithInsecure()) + clientCon, err := grpc.Dial(unixFile, opt, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) require.NotNil(t, clientCon) diff --git a/store/mockstore/unistore/pd/BUILD.bazel b/store/mockstore/unistore/pd/BUILD.bazel index e57867b014e47..5d5563cbdc153 100644 --- a/store/mockstore/unistore/pd/BUILD.bazel +++ b/store/mockstore/unistore/pd/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "@com_github_pingcap_log//:log", "@com_github_tikv_pd_client//:client", "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//credentials/insecure", "@org_uber_go_zap//:zap", ], ) diff --git a/store/mockstore/unistore/pd/client.go b/store/mockstore/unistore/pd/client.go index 55547e9461899..96d53eb8d54bf 100644 --- a/store/mockstore/unistore/pd/client.go +++ b/store/mockstore/unistore/pd/client.go @@ -29,6 +29,7 @@ import ( pd "github.com/tikv/pd/client" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) // Client is a PD (Placement Driver) client. @@ -231,7 +232,7 @@ func (c *client) getOrCreateConn(addr string) (*grpc.ClientConn, error) { if err != nil { return nil, err } - cc, err := grpc.Dial(u.Host, grpc.WithInsecure()) + cc, err := grpc.Dial(u.Host, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, err } diff --git a/store/mockstore/unistore/tikv/BUILD.bazel b/store/mockstore/unistore/tikv/BUILD.bazel index 91db06dd09dfa..bc7ecacf382fc 100644 --- a/store/mockstore/unistore/tikv/BUILD.bazel +++ b/store/mockstore/unistore/tikv/BUILD.bazel @@ -54,6 +54,7 @@ go_library( "@com_github_tikv_client_go_v2//oracle", "@com_github_tikv_pd_client//:client", "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_x_exp//slices", "@org_uber_go_zap//:zap", ], diff --git a/store/mockstore/unistore/tikv/deadlock.go b/store/mockstore/unistore/tikv/deadlock.go index 7eeb1fb2c5b64..7e8b0179e082d 100644 --- a/store/mockstore/unistore/tikv/deadlock.go +++ b/store/mockstore/unistore/tikv/deadlock.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/tidb/store/mockstore/unistore/util/lockwaiter" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) // Follower will send detection rpc to Leader @@ -100,7 +101,7 @@ func (dt *DetectorClient) rebuildStreamClient() error { if err != nil { return err } - cc, err := grpc.Dial(leaderAddr, grpc.WithInsecure()) + cc, err := grpc.Dial(leaderAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return err } diff --git a/tidb-binlog/pump_client/BUILD.bazel b/tidb-binlog/pump_client/BUILD.bazel index ad98822adaf5b..863fe7b61f8f9 100644 --- a/tidb-binlog/pump_client/BUILD.bazel +++ b/tidb-binlog/pump_client/BUILD.bazel @@ -21,6 +21,7 @@ go_library( "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//status", "@org_uber_go_zap//:zap", ], @@ -41,5 +42,6 @@ go_test( "@com_github_pingcap_tipb//go-binlog", "@com_github_stretchr_testify//require", "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//credentials/insecure", ], ) diff --git a/tidb-binlog/pump_client/bench_test.go b/tidb-binlog/pump_client/bench_test.go index fe3eb2f6ffb30..ae93203319e21 100644 --- a/tidb-binlog/pump_client/bench_test.go +++ b/tidb-binlog/pump_client/bench_test.go @@ -23,6 +23,7 @@ import ( pb "github.com/pingcap/tipb/go-binlog" "github.com/stretchr/testify/require" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) func Benchmark100Thread(b *testing.B) { @@ -86,7 +87,7 @@ func createMockPumpsClientAndServer(b *testing.B) (*PumpsClient, *mockPumpServer return net.DialTimeout("tcp", addr, timeout) }) - clientCon, err := grpc.Dial(addr, opt, grpc.WithInsecure()) + clientCon, err := grpc.Dial(addr, opt, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { b.Fatal(err) } diff --git a/tidb-binlog/pump_client/client_test.go b/tidb-binlog/pump_client/client_test.go index ac287773072ed..974ed76d29aa8 100644 --- a/tidb-binlog/pump_client/client_test.go +++ b/tidb-binlog/pump_client/client_test.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/tipb/go-binlog" "github.com/stretchr/testify/require" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) var ( @@ -176,7 +177,7 @@ func TestWriteBinlog(t *testing.T) { opt := grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { return net.DialTimeout(cfg.serverMode, addr, timeout) }) - clientCon, err := grpc.Dial(cfg.addr, opt, grpc.WithInsecure()) + clientCon, err := grpc.Dial(cfg.addr, opt, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) require.NotNil(t, clientCon) pumpClient := mockPumpsClient(binlog.NewPumpClient(clientCon), true) diff --git a/tidb-binlog/pump_client/pump.go b/tidb-binlog/pump_client/pump.go index 82fa48da92da2..4459bb1bfc5ef 100644 --- a/tidb-binlog/pump_client/pump.go +++ b/tidb-binlog/pump_client/pump.go @@ -29,6 +29,7 @@ import ( "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) var ( @@ -103,7 +104,7 @@ func (p *PumpStatus) createGrpcClient() error { if p.security != nil { clientConn, err = grpc.Dial(p.Addr, dialerOpt, grpc.WithTransportCredentials(credentials.NewTLS(p.security))) } else { - clientConn, err = grpc.Dial(p.Addr, dialerOpt, grpc.WithInsecure()) + clientConn, err = grpc.Dial(p.Addr, dialerOpt, grpc.WithTransportCredentials(insecure.NewCredentials())) } if err != nil { atomic.AddInt64(&p.ErrNum, 1) diff --git a/util/topsql/BUILD.bazel b/util/topsql/BUILD.bazel index f90cf35b09e8f..9cfac0291454c 100644 --- a/util/topsql/BUILD.bazel +++ b/util/topsql/BUILD.bazel @@ -42,6 +42,7 @@ go_test( "@com_github_pingcap_tipb//go-tipb", "@com_github_stretchr_testify//require", "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//credentials/insecure", "@org_golang_google_grpc//keepalive", "@org_uber_go_goleak//:goleak", ], diff --git a/util/topsql/reporter/BUILD.bazel b/util/topsql/reporter/BUILD.bazel index 6c1def091ee39..98a83a0d00910 100644 --- a/util/topsql/reporter/BUILD.bazel +++ b/util/topsql/reporter/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "@com_github_wangjohn_quickselect//:quickselect", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//backoff", + "@org_golang_google_grpc//credentials/insecure", "@org_uber_go_atomic//:atomic", "@org_uber_go_zap//:zap", ], diff --git a/util/topsql/reporter/single_target.go b/util/topsql/reporter/single_target.go index bf66414b674d4..16c88956453cd 100644 --- a/util/topsql/reporter/single_target.go +++ b/util/topsql/reporter/single_target.go @@ -28,6 +28,7 @@ import ( "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials/insecure" ) const ( @@ -357,7 +358,7 @@ func (*SingleTargetDataSink) dial(ctx context.Context, targetRPCAddr string) (*g dialCtx, targetRPCAddr, grpc.WithBlock(), - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithInitialWindowSize(grpcInitialWindowSize), grpc.WithInitialConnWindowSize(grpcInitialConnWindowSize), grpc.WithDefaultCallOptions( diff --git a/util/topsql/topsql_test.go b/util/topsql/topsql_test.go index 04855ac163011..1862b090a94de 100644 --- a/util/topsql/topsql_test.go +++ b/util/topsql/topsql_test.go @@ -32,6 +32,7 @@ import ( "github.com/pingcap/tipb/go-tipb" "github.com/stretchr/testify/require" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" ) @@ -241,7 +242,7 @@ func TestTopSQLPubSub(t *testing.T) { conn, err := grpc.Dial( server.Address(), grpc.WithBlock(), - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 10 * time.Second, Timeout: 3 * time.Second, @@ -363,7 +364,7 @@ func TestPubSubWhenReporterIsStopped(t *testing.T) { conn, err := grpc.Dial( server.Address(), grpc.WithBlock(), - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 10 * time.Second, Timeout: 3 * time.Second,