diff --git a/br/pkg/lightning/config/config.go b/br/pkg/lightning/config/config.go index 4682a826e0712..e5d16592fe91c 100644 --- a/br/pkg/lightning/config/config.go +++ b/br/pkg/lightning/config/config.go @@ -1069,10 +1069,7 @@ func (cfg *Config) CheckAndAdjustTiDBPort(ctx context.Context, mustHaveInternalC if cfg.TiDB.Port <= 0 { cfg.TiDB.Port = int(settings.Port) } - if len(cfg.TiDB.PdAddr) == 0 { - pdAddrs := strings.Split(settings.Path, ",") - cfg.TiDB.PdAddr = pdAddrs[0] // FIXME support multiple PDs once importer can. - } + cfg.TiDB.PdAddr = settings.Path } if cfg.TiDB.Port <= 0 { diff --git a/br/pkg/lightning/restore/checksum.go b/br/pkg/lightning/restore/checksum.go index 96fa7df007fc4..00216a4b91006 100644 --- a/br/pkg/lightning/restore/checksum.go +++ b/br/pkg/lightning/restore/checksum.go @@ -19,6 +19,7 @@ import ( "context" "database/sql" "fmt" + "strings" "sync" "time" @@ -82,7 +83,8 @@ func newChecksumManager(ctx context.Context, rc *Controller, store kv.Storage) ( var manager ChecksumManager if pdVersion.Major >= 4 { tlsOpt := rc.tls.ToPDSecurityOption() - pdCli, err := pd.NewClientWithContext(ctx, []string{pdAddr}, tlsOpt) + addrs := strings.Split(pdAddr, ",") + pdCli, err := pd.NewClientWithContext(ctx, addrs, tlsOpt) if err != nil { return nil, errors.Trace(err) } diff --git a/br/pkg/lightning/restore/restore.go b/br/pkg/lightning/restore/restore.go index bdbf30652873a..290a85a97aa0b 100644 --- a/br/pkg/lightning/restore/restore.go +++ b/br/pkg/lightning/restore/restore.go @@ -346,7 +346,8 @@ func NewRestoreControllerWithPauser( if maxOpenFiles < 0 { maxOpenFiles = math.MaxInt32 } - pdCli, err = pd.NewClientWithContext(ctx, []string{cfg.TiDB.PdAddr}, tls.ToPDSecurityOption()) + addrs := strings.Split(cfg.TiDB.PdAddr, ",") + pdCli, err = pd.NewClientWithContext(ctx, addrs, tls.ToPDSecurityOption()) if err != nil { return nil, errors.Trace(err) } @@ -1354,7 +1355,8 @@ const ( func (rc *Controller) keepPauseGCForDupeRes(ctx context.Context) (<-chan struct{}, error) { tlsOpt := rc.tls.ToPDSecurityOption() - pdCli, err := pd.NewClientWithContext(ctx, []string{rc.pdCli.GetLeaderAddr()}, tlsOpt) + addrs := strings.Split(rc.cfg.TiDB.PdAddr, ",") + pdCli, err := pd.NewClientWithContext(ctx, addrs, tlsOpt) if err != nil { return nil, errors.Trace(err) }