Skip to content

Commit

Permalink
feat: add Init before AddInstance while backing up
Browse files Browse the repository at this point in the history
Signed-off-by: mlycore <[email protected]>
  • Loading branch information
mlycore committed Dec 15, 2023
1 parent 081b0bb commit 8cb6480
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pitr/agent/internal/handler/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func Backup(ctx *fiber.Ctx) error {
return fmt.Errorf(efmt, in.Username, len(in.Password), in.DBName, err)
}

if err := pkg.OG.Init(in.DnBackupPath); err != nil {
return fmt.Errorf("init instance failed, err: %w", err)
}

// try to add backup instance
if err := pkg.OG.AddInstance(in.DnBackupPath, in.Instance); err != nil && !errors.Is(err, cons.InstanceAlreadyExist) {
return fmt.Errorf("add instance failed, err wrap: %w", err)
Expand Down

0 comments on commit 8cb6480

Please sign in to comment.