Skip to content

Commit

Permalink
check keyspace snapshot time if none specified for backup restores
Browse files Browse the repository at this point in the history
Signed-off-by: Priya Bibra <pbibra@slack-corp.com>
  • Loading branch information
pbibra committed Jul 19, 2023
1 parent adc57a0 commit 5f444f1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion go/vt/vttablet/tabletmanager/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ func (tm *TabletManager) restoreDataLocked(ctx context.Context, logger logutil.L
log.Infof("Using base_keyspace %v to restore keyspace %v using a backup time of %v", keyspace, tablet.Keyspace, logutil.ProtoToTime(request.BackupTime))
}

startTime := logutil.ProtoToTime(request.BackupTime)
if startTime.IsZero() {
startTime = logutil.ProtoToTime(keyspaceInfo.SnapshotTime)
}

params := mysqlctl.RestoreParams{
Cnf: tm.Cnf,
Mysqld: tm.MysqlDaemon,
Expand All @@ -195,7 +200,7 @@ func (tm *TabletManager) restoreDataLocked(ctx context.Context, logger logutil.L
DbName: topoproto.TabletDbName(tablet),
Keyspace: keyspace,
Shard: tablet.Shard,
StartTime: logutil.ProtoToTime(request.BackupTime),
StartTime: startTime,
DryRun: request.DryRun,
Stats: backupstats.RestoreStats(),
}
Expand Down

0 comments on commit 5f444f1

Please sign in to comment.