diff --git a/pkg/backup/client.go b/pkg/backup/client.go index 09f9dd4eb..c1a1ad4a9 100644 --- a/pkg/backup/client.go +++ b/pkg/backup/client.go @@ -272,6 +272,11 @@ func BuildBackupRangeAndSchema( seqAlloc := autoid.NewAllocator(storage, dbInfo.ID, false, autoid.SequenceType) randAlloc := autoid.NewAllocator(storage, dbInfo.ID, false, autoid.AutoRandomType) + if len(dbInfo.Tables) == 0 { + log.Warn("It's not necessary for backing up empty database", + zap.Stringer("db", dbInfo.Name)) + continue + } for _, tableInfo := range dbInfo.Tables { if !tableFilter.MatchTable(dbInfo.Name.O, tableInfo.Name.O) { // Skip tables other than the given table. diff --git a/pkg/task/backup.go b/pkg/task/backup.go index 23fa3e29d..9d3e1445c 100644 --- a/pkg/task/backup.go +++ b/pkg/task/backup.go @@ -5,6 +5,7 @@ package task import ( "context" "strconv" + "strings" "time" "github.com/pingcap/br/pkg/utils" @@ -264,6 +265,9 @@ func RunBackup(c context.Context, g glue.Glue, cmdName string, cfg *BackupConfig if err2 != nil { return err2 } + pdAddress := strings.Join(cfg.PD, ",") + log.Warn("Nothing to backup, maybe connected to cluster for restoring", + zap.String("PD address", pdAddress)) return client.SaveBackupMeta(ctx, &backupMeta) }