Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
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
2 changes: 1 addition & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
initOnce = sync.Once{}
defaultContext context.Context
hasLogFile uint64
tidbGlue = gluetidb.Glue{}
tidbGlue = gluetidb.New()
envLogToTermKey = "BR_LOG_TO_TERM"
)

Expand Down
11 changes: 11 additions & 0 deletions pkg/gluetidb/glue.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ package gluetidb
import (
"context"

"github.com/pingcap/log"
"github.com/pingcap/parser/model"
"github.com/pingcap/parser/mysql"
pd "github.com/pingcap/pd/v4/client"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/ddl"
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/kv"
Expand All @@ -17,6 +19,15 @@ import (
"github.com/pingcap/br/pkg/gluetikv"
)

// New makes a new tidb glue.
func New() Glue {
log.Debug("enabling no register config")
config.UpdateGlobal(func(conf *config.Config) {
conf.SkipRegisterToDashboard = true
})
return Glue{}
}

// Glue is an implementation of glue.Glue using a new TiDB session.
type Glue struct {
tikvGlue gluetikv.Glue
Expand Down
4 changes: 2 additions & 2 deletions pkg/restore/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *testRestoreClientSuite) TestCreateTables(c *C) {
c.Assert(s.mock.Start(), IsNil)
defer s.mock.Stop()

client, err := restore.NewRestoreClient(context.Background(), gluetidb.Glue{}, s.mock.PDClient, s.mock.Storage, nil)
client, err := restore.NewRestoreClient(context.Background(), gluetidb.New(), s.mock.PDClient, s.mock.Storage, nil)
c.Assert(err, IsNil)

info, err := s.mock.Domain.GetSnapshotInfoSchema(math.MaxInt64)
Expand Down Expand Up @@ -98,7 +98,7 @@ func (s *testRestoreClientSuite) TestIsOnline(c *C) {
c.Assert(s.mock.Start(), IsNil)
defer s.mock.Stop()

client, err := restore.NewRestoreClient(context.Background(), gluetidb.Glue{}, s.mock.PDClient, s.mock.Storage, nil)
client, err := restore.NewRestoreClient(context.Background(), gluetidb.New(), s.mock.PDClient, s.mock.Storage, nil)
c.Assert(err, IsNil)

c.Assert(client.IsOnline(), IsFalse)
Expand Down
2 changes: 1 addition & 1 deletion pkg/restore/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *testRestoreSchemaSuite) TestRestoreAutoIncID(c *C) {
c.Assert(autoIncID, Equals, uint64(globalAutoID))
// Alter AutoIncID to the next AutoIncID + 100
table.Info.AutoIncID = globalAutoID + 100
db, err := restore.NewDB(gluetidb.Glue{}, s.mock.Storage)
db, err := restore.NewDB(gluetidb.New(), s.mock.Storage)
c.Assert(err, IsNil, Commentf("Error create DB"))
tk.MustExec("drop database if exists test;")
// Test empty collate value
Expand Down