Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

br: set volume backup failed if one data plane failed #5500

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions pkg/fedvolumebackup/backup/backup_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ func (bm *backupManager) teardownVolumeBackup(ctx context.Context, volumeBackup
}

func (bm *backupManager) waitVolumeBackupComplete(ctx context.Context, volumeBackup *v1alpha1.VolumeBackup, backupMembers []*volumeBackupMember) error {
isBackupRunning := false
for _, backupMember := range backupMembers {
if pingcapv1alpha1.IsVolumeBackupInitializeFailed(backupMember.backup) || pingcapv1alpha1.IsBackupFailed(backupMember.backup) {
errMsg := fmt.Sprintf("backup member %s of cluster %s failed", backupMember.backup.Name, backupMember.k8sClusterName)
Expand All @@ -418,13 +419,19 @@ func (bm *backupManager) waitVolumeBackupComplete(ctx context.Context, volumeBac
return nil
}
if !pingcapv1alpha1.IsBackupComplete(backupMember.backup) {
return controller.IgnoreErrorf(
"backup member %s of cluster %s is not complete", backupMember.backup.Name, backupMember.k8sClusterName)
isBackupRunning = true
klog.Infof(
"VolumeBackup %s/%s backup member %s of cluster %s is not complete",
volumeBackup.Namespace, volumeBackup.Name, backupMember.backup.Name, backupMember.k8sClusterName)
}
}

klog.Infof("VolumeBackup %s/%s backup complete", volumeBackup.Namespace, volumeBackup.Name)
return bm.setVolumeBackupComplete(&volumeBackup.Status, backupMembers)
if isBackupRunning {
return controller.IgnoreErrorf("wait VolumeBackup complete")
} else {
klog.Infof("VolumeBackup %s/%s backup complete", volumeBackup.Namespace, volumeBackup.Name)
return bm.setVolumeBackupComplete(&volumeBackup.Status, backupMembers)
}
}

func (bm *backupManager) setVolumeBackupSnapshotCreated(volumeBackupStatus *v1alpha1.VolumeBackupStatus) {
Expand Down
Loading