Skip to content

Commit

Permalink
br: modify set complete status after warmup complete for vrt
Browse files Browse the repository at this point in the history
Signed-off-by: WangLe1321 <[email protected]>
  • Loading branch information
WangLe1321 committed Aug 16, 2023
1 parent 4c7daa7 commit e7d570a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
15 changes: 0 additions & 15 deletions pkg/backup/restore/restore_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1192,21 +1192,6 @@ func (rm *restoreManager) makeAsyncWarmUpJob(r *v1alpha1.Restore, tikvPod *corev
}
}

/*warmUpVolumeNames := make([]string, 0, len(warmUpVolumeMounts))
for _, volumeMount := range warmUpVolumeMounts {
warmUpVolumeNames = append(warmUpVolumeNames, volumeMount.Name)
}
if len(warmUpPaths) != len(warmUpVolumeNames) {
return nil, fmt.Errorf("lengths of mounted paths %v and volumes %v in tikv pod %s/%s are not equal", warmUpPaths, warmUpVolumeNames, ns, podName)
}*/

/*fioCommands := make([]string, 0, len(warmUpPaths))
for i := range warmUpPaths {
fioSubCommand := fmt.Sprintf(warmUpVolumeTemplate, warmUpPaths[i], warmUpPaths[i], warmUpVolumeNames[i])
fioCommands = append(fioCommands, strings.ReplaceAll(fioSubCommand, "\n", "; "))
}
fioCommand := strings.Join(fioCommands, "; ")*/

args := []string{"--fs", constants.TiKVDataVolumeMountPath}
fioPaths := make([]string, 0, len(warmUpPaths))
for _, warmUpPath := range warmUpPaths {
Expand Down
15 changes: 11 additions & 4 deletions pkg/controller/fedvolumerestore/fed_volume_restore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package fedvolumerestore

import (
"fmt"
pingcapv1alpha1 "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1"
"time"

perrors "github.com/pingcap/errors"
Expand Down Expand Up @@ -158,13 +159,19 @@ func (c *Controller) updateRestore(cur interface{}) {
return
}

if v1alpha1.IsVolumeRestoreComplete(newVolumeRestore) {
klog.V(4).Infof("volume restore %s/%s is complete, skipping.", ns, name)
if v1alpha1.IsVolumeRestoreFailed(newVolumeRestore) {
klog.V(4).Infof("volume restore %s/%s is failed, skipping.", ns, name)
return
}

if v1alpha1.IsVolumeRestoreFailed(newVolumeRestore) {
klog.V(4).Infof("volume restore %s/%s is failed, skipping.", ns, name)
if newVolumeRestore.Spec.Template.Warmup == pingcapv1alpha1.RestoreWarmupModeASync {
if !v1alpha1.IsVolumeRestoreWarmUpComplete(newVolumeRestore) {
c.enqueueRestore(newVolumeRestore)
}
}

if v1alpha1.IsVolumeRestoreComplete(newVolumeRestore) {
klog.V(4).Infof("volume restore %s/%s is complete, skipping.", ns, name)
return
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/fedvolumebackup/restore/restore_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func (rm *restoreManager) syncRestore(volumeRestore *v1alpha1.VolumeRestore) err
return err
}

if !v1alpha1.IsVolumeRestoreWarmUpComplete(volumeRestore) {
klog.Infof("VolumeRestore %s/%s data planes all complete, but warmup doesn't complete, wait warmup complete", ns, name)
return nil
}

klog.Infof("VolumeRestore %s/%s restore complete", ns, name)
rm.setVolumeRestoreComplete(&volumeRestore.Status, restoreMembers)
return nil
Expand Down

0 comments on commit e7d570a

Please sign in to comment.