From 10f04de84779043933078b05a73969867572690f Mon Sep 17 00:00:00 2001 From: Neil Shen Date: Wed, 11 Mar 2020 10:39:32 +0800 Subject: [PATCH 1/2] conn: use GetDomain to avoid some TiDB breaking changes Signed-off-by: Neil Shen --- pkg/conn/conn.go | 2 +- pkg/glue/glue.go | 2 +- pkg/gluetidb/glue.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/conn/conn.go b/pkg/conn/conn.go index 2ab0a0232..6226b6b98 100644 --- a/pkg/conn/conn.go +++ b/pkg/conn/conn.go @@ -159,7 +159,7 @@ func NewMgr( return nil, errors.Errorf("tikv cluster not health %+v", stores) } - dom, err := g.BootstrapSession(storage) + dom, err := g.GetDomain(storage) if err != nil { return nil, errors.Trace(err) } diff --git a/pkg/glue/glue.go b/pkg/glue/glue.go index b680370aa..f8e97e01e 100644 --- a/pkg/glue/glue.go +++ b/pkg/glue/glue.go @@ -12,7 +12,7 @@ import ( // Glue is an abstraction of TiDB function calls used in BR. type Glue interface { - BootstrapSession(store kv.Storage) (*domain.Domain, error) + GetDomain(store kv.Storage) (*domain.Domain, error) CreateSession(store kv.Storage) (Session, error) Open(path string, option pd.SecurityOption) (kv.Storage, error) } diff --git a/pkg/gluetidb/glue.go b/pkg/gluetidb/glue.go index 27ae01c37..ef1b55f5c 100644 --- a/pkg/gluetidb/glue.go +++ b/pkg/gluetidb/glue.go @@ -24,9 +24,9 @@ type tidbSession struct { se session.Session } -// BootstrapSession implements glue.Glue -func (Glue) BootstrapSession(store kv.Storage) (*domain.Domain, error) { - return session.BootstrapSession(store) +// GetDomain implements glue.Glue +func (Glue) GetDomain(store kv.Storage) (*domain.Domain, error) { + return session.GetDomain(store) } // CreateSession implements glue.Glue From 64accbe2f93378be2cb1d5232153b47254f5cc1b Mon Sep 17 00:00:00 2001 From: Neil Shen Date: Wed, 11 Mar 2020 12:21:08 +0800 Subject: [PATCH 2/2] minor usability improvement Signed-off-by: Neil Shen --- cmd/backup.go | 2 +- cmd/restore.go | 2 +- pkg/utils/progress.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/backup.go b/cmd/backup.go index 5dc6e3a32..dee9f03e6 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -30,7 +30,7 @@ func runBackupRawCommand(command *cobra.Command, cmdName string) error { func NewBackupCommand() *cobra.Command { command := &cobra.Command{ Use: "backup", - Short: "backup a TiDB cluster", + Short: "backup a TiDB/TiKV cluster", SilenceUsage: false, PersistentPreRunE: func(c *cobra.Command, args []string) error { if err := Init(c); err != nil { diff --git a/cmd/restore.go b/cmd/restore.go index f508f0342..0f903f92e 100644 --- a/cmd/restore.go +++ b/cmd/restore.go @@ -21,7 +21,7 @@ func runRestoreCommand(command *cobra.Command, cmdName string) error { func NewRestoreCommand() *cobra.Command { command := &cobra.Command{ Use: "restore", - Short: "restore a TiKV cluster from a backup", + Short: "restore a TiDB/TiKV cluster", SilenceUsage: false, PersistentPreRunE: func(c *cobra.Command, args []string) error { if err := Init(c); err != nil { diff --git a/pkg/utils/progress.go b/pkg/utils/progress.go index 8c66093f0..4d356e02f 100644 --- a/pkg/utils/progress.go +++ b/pkg/utils/progress.go @@ -55,7 +55,7 @@ func (pp *ProgressPrinter) goPrintProgress( bar.Set(pb.Color, true) bar.SetWriter(&wrappedWriter{name: pp.name}) } else { - tmpl := `{{string . "barName" | red}} {{ bar . "<" "-" (cycle . "-" "\\" "|" "/" ) "." ">"}} {{percent .}}` + tmpl := `{{string . "barName" | green}} {{ bar . "<" "-" (cycle . "-" "\\" "|" "/" ) "." ">"}} {{percent .}}` bar = pb.ProgressBarTemplate(tmpl).Start64(pp.total) bar.Set("barName", pp.name) }