Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
move pd scheduler to separated pkg (#532)
Browse files Browse the repository at this point in the history
* move pd scheduler to separate struct

* add comments

* fix import

* fix test

* add NewPdController

* add missing comment

* move pd controller to separated pkg

* fix

* make PDController in Mgr anonymous
  • Loading branch information
glorv authored Sep 28, 2020
1 parent e9fc669 commit 3bf2cde
Show file tree
Hide file tree
Showing 7 changed files with 634 additions and 570 deletions.
8 changes: 4 additions & 4 deletions cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/tikv/pd/pkg/mock/mockid"
"go.uber.org/zap"

"github.com/pingcap/br/pkg/conn"
"github.com/pingcap/br/pkg/pdutil"
"github.com/pingcap/br/pkg/restore"
"github.com/pingcap/br/pkg/rtree"
"github.com/pingcap/br/pkg/task"
Expand Down Expand Up @@ -346,7 +346,7 @@ func setPDConfigCommand() *cobra.Command {
}
defer mgr.Close()

for scheduler := range conn.Schedulers {
for scheduler := range pdutil.Schedulers {
if strings.HasPrefix(scheduler, "balance") {
err := mgr.AddScheduler(ctx, scheduler)
if err != nil {
Expand All @@ -357,10 +357,10 @@ func setPDConfigCommand() *cobra.Command {
}
}

if err := mgr.UpdatePDScheduleConfig(ctx, conn.DefaultPDCfg); err != nil {
if err := mgr.UpdatePDScheduleConfig(ctx, pdutil.DefaultPDCfg); err != nil {
return errors.Annotate(err, "fail to update PD merge config")
}
log.Info("add pd configs succeed", zap.Any("config", conn.DefaultPDCfg))
log.Info("add pd configs succeed", zap.Any("config", pdutil.DefaultPDCfg))
return nil
},
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/backup/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/pingcap/br/pkg/backup"
"github.com/pingcap/br/pkg/conn"
"github.com/pingcap/br/pkg/pdutil"
)

type testBackup struct {
Expand All @@ -39,9 +40,9 @@ func (r *testBackup) SetUpSuite(c *C) {
mvccStore := mocktikv.MustNewMVCCStore()
r.mockPDClient = mocktikv.NewPDClient(mocktikv.NewCluster(mvccStore))
r.ctx, r.cancel = context.WithCancel(context.Background())
mockMgr := &conn.Mgr{}
mockMgr := &conn.Mgr{PdController: &pdutil.PdController{}}
mockMgr.SetPDClient(r.mockPDClient)
mockMgr.SetPDHTTP([]string{"test"}, nil)
mockMgr.SetHTTP([]string{"test"}, nil)
var err error
r.backupClient, err = backup.NewBackupClient(r.ctx, mockMgr)
c.Assert(err, IsNil)
Expand Down
Loading

0 comments on commit 3bf2cde

Please sign in to comment.