Skip to content

Commit

Permalink
Merge pull request #8891 from planetscale/PR8824-followup
Browse files Browse the repository at this point in the history
Correctly identify backup timestamp var as a string
  • Loading branch information
ajm188 authored Sep 27, 2021
2 parents 73d91f3 + 4ff4a32 commit ca5a27e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/vt/vtctl/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func commandRemoveBackup(ctx context.Context, wr *wrangler.Wrangler, subFlags *f
}

func commandRestoreFromBackup(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
backupTimestamp := subFlags.String("backup_timestamp", "", "Use the backup taken at or before this timestamp rather than using the latest backup.")
backupTimestampStr := subFlags.String("backup_timestamp", "", "Use the backup taken at or before this timestamp rather than using the latest backup.")
if err := subFlags.Parse(args); err != nil {
return err
}
Expand All @@ -253,11 +253,11 @@ func commandRestoreFromBackup(ctx context.Context, wr *wrangler.Wrangler, subFla
backupTime := time.Time{}

// Or if a backup timestamp was specified then we use the last backup taken at or before that time
if *backupTimestamp != "" {
if *backupTimestampStr != "" {
var err error
backupTime, err = time.Parse(mysqlctl.BackupTimestampFormat, *backupTimestamp)
backupTime, err = time.Parse(mysqlctl.BackupTimestampFormat, *backupTimestampStr)
if err != nil {
return vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, fmt.Sprintf("unable to parse the backup timestamp value provided of '%s'", *backupTimestamp))
return vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, fmt.Sprintf("unable to parse the backup timestamp value provided of '%s'", *backupTimestampStr))
}
}

Expand Down

0 comments on commit ca5a27e

Please sign in to comment.