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

remove temp data in pv for backup #2897

Merged
merged 12 commits into from
Jul 14, 2020
5 changes: 5 additions & 0 deletions cmd/backup-manager/app/export/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package export

import (
"database/sql"
"os"
"strings"
"time"

Expand Down Expand Up @@ -282,6 +283,8 @@ func (bm *BackupManager) performBackup(backup *v1alpha1.Backup, db *sql.DB) erro
return errorutils.NewAggregate(errs)
}
klog.Infof("archive cluster %s backup data %s success", bm, archiveBackupPath)
// archive succeed, origin dir can be deleted safely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCommitTsFromMetadata in L305 will fail.

os.RemoveAll(backupFullPath)

opts := util.GetOptions(backup.Spec.StorageProvider)
size, err := getBackupSize(archiveBackupPath, opts)
Expand Down Expand Up @@ -330,6 +333,8 @@ func (bm *BackupManager) performBackup(backup *v1alpha1.Backup, db *sql.DB) erro
return errorutils.NewAggregate(errs)
}
klog.Infof("backup cluster %s data to %s success", bm, bm.StorageType)
// backup to remote succeed, archive can be deleted now
os.RemoveAll(archiveBackupPath)

finish := time.Now()

Expand Down