-
Notifications
You must be signed in to change notification settings - Fork 500
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
Changes from 4 commits
40dbdcd
2e7a0ca
91b70ac
904a335
df73f02
d44f5c9
1a50ece
08a6892
9e83ca4
9d5c506
b73460a
a23fa3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ package export | |
|
||
import ( | ||
"database/sql" | ||
"os" | ||
"strings" | ||
"time" | ||
|
||
|
@@ -262,6 +263,8 @@ func (bm *BackupManager) performBackup(backup *v1alpha1.Backup, db *sql.DB) erro | |
Message: backupErr.Error(), | ||
}) | ||
errs = append(errs, uerr) | ||
// just delete backupFullPath since it will never be used except for debug | ||
os.RemoveAll(backupFullPath) | ||
return errorutils.NewAggregate(errs) | ||
} | ||
klog.Infof("dump cluster %s data to %s success", bm, backupFullPath) | ||
|
@@ -282,6 +285,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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
@@ -330,6 +335,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() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ package _import | |
import ( | ||
"database/sql" | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"time" | ||
|
||
|
@@ -166,6 +167,8 @@ func (rm *RestoreManager) performRestore(restore *v1alpha1.Restore) error { | |
return errorutils.NewAggregate(errs) | ||
} | ||
klog.Infof("unarchive cluster %s backup %s data success", rm, restoreDataPath) | ||
// unarchive succeed, origin archive can be deleted now | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about keeping the tar, it does not make much difference since we keep the unarchieved files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressed in df73f02 |
||
os.RemoveAll(restoreDataPath) | ||
|
||
err = rm.loadTidbClusterData(unarchiveDataPath) | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's useful for debug, can we keep it just in case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in df73f02