Skip to content

Commit

Permalink
br: modify time complete of restore status (#5248)
Browse files Browse the repository at this point in the history
  • Loading branch information
WangLe1321 authored Aug 22, 2023
1 parent aeed0a4 commit cb6b246
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cmd/backup-manager/app/restore/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ func (rm *Manager) performRestore(ctx context.Context, restore *v1alpha1.Restore
restoreType = v1alpha1.RestoreVolumeComplete
} else {
restoreType = v1alpha1.RestoreDataComplete
allFinished = true
}
default:
ts, err := util.GetCommitTsFromBRMetaData(ctx, restore.Spec.StorageProvider)
Expand All @@ -314,8 +313,10 @@ func (rm *Manager) performRestore(ctx context.Context, restore *v1alpha1.Restore
}

updateStatus := &controller.RestoreUpdateStatus{
TimeStarted: &metav1.Time{Time: started},
CommitTs: commitTS,
CommitTs: commitTS,
}
if restore.Status.TimeStarted.Unix() <= 0 {
updateStatus.TimeStarted = &metav1.Time{Time: started}
}
if allFinished {
updateStatus.TimeCompleted = &metav1.Time{Time: time.Now()}
Expand Down
5 changes: 4 additions & 1 deletion pkg/backup/restore/restore_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,13 @@ func (rm *restoreManager) volumeSnapshotRestore(r *v1alpha1.Restore, tc *v1alpha
}

// restore TidbCluster completed
newStatus := &controller.RestoreUpdateStatus{
TimeCompleted: &metav1.Time{Time: time.Now()},
}
if err := rm.statusUpdater.Update(r, &v1alpha1.RestoreCondition{
Type: v1alpha1.RestoreComplete,
Status: corev1.ConditionTrue,
}, nil); err != nil {
}, newStatus); err != nil {
return "UpdateRestoreCompleteFailed", err
}
return "", nil
Expand Down

0 comments on commit cb6b246

Please sign in to comment.