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

fix: backup will skip empty databases. #560

Merged
merged 7 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,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.
Expand Down
1 change: 1 addition & 0 deletions pkg/task/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ func RunBackup(c context.Context, g glue.Glue, cmdName string, cfg *BackupConfig
if err2 != nil {
return err2
}
log.Warn("N0thing to backup, maybe connected to cluster for restoring")
tangwz marked this conversation as resolved.
Show resolved Hide resolved
return client.SaveBackupMeta(ctx, &backupMeta)
}

Expand Down