From 8593d5081c6efb219ed6bab933808cebd4302494 Mon Sep 17 00:00:00 2001 From: woblerr Date: Sun, 14 Jul 2024 14:03:39 +0300 Subject: [PATCH] Save backup deletion statuses if any errors occur during deletion process for local backups. --- cmd/backup_clean.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/backup_clean.go b/cmd/backup_clean.go index 4a2eb4c..e477cda 100644 --- a/cmd/backup_clean.go +++ b/cmd/backup_clean.go @@ -166,7 +166,7 @@ func cleanBackup() error { err = backupCleanFilePlugin(backupCleanCascade, beforeTimestamp, backupCleanPluginConfigFile, pluginConfig, &parseHData) if err != nil { // In current implementation, there are cases where some backups were deleted, and some were not. - // Foe example, the clean command was executed without --cascade option. + // For example, the clean command was executed without --cascade option. // In this case - metadata backup was deleted, but full + incremental - weren't. // We should update the history file even it error occurred. errUpdateHFile := parseHData.UpdateHistoryFile(hFile) @@ -179,6 +179,10 @@ func cleanBackup() error { } else { err := backupCleanFileLocal(backupCleanCascade, beforeTimestamp, &parseHData) if err != nil { + errUpdateHFile := parseHData.UpdateHistoryFile(hFile) + if errUpdateHFile != nil { + gplog.Error(textmsg.ErrorTextUnableActionHistoryFile("update", errUpdateHFile)) + } return err } } @@ -249,7 +253,6 @@ func backupCleanFileLocal(deleteCascade bool, cutOffTimestamp string, parseHData backupList := getBackupNamesBeforeTimestampFile(cutOffTimestamp, false, parseHData) gplog.Debug(textmsg.InfoTextBackupDeleteList(backupList)) err := backupDeleteFileLocal(backupList, "", deleteCascade, false, false, 1, parseHData) - if err != nil { return err }