Merge pull request #7096 from Lyndon-Li/issue-fix-7094

Issue 7094: fallback to full backup if previous snapshot is not found
This commit is contained in:
Wenkai Yin(尹文开)
2023-11-14 11:45:32 +08:00
committed by GitHub
3 changed files with 6 additions and 5 deletions

View File

@@ -0,0 +1 @@
Fix issue #7094, fallback to full backup if previous snapshot is not found

View File

@@ -236,10 +236,10 @@ func SnapshotSource(
mani, err := loadSnapshotFunc(ctx, rep, manifest.ID(parentSnapshot))
if err != nil {
return "", 0, errors.Wrapf(err, "Failed to load previous snapshot %v from kopia", parentSnapshot)
log.WithError(err).Warnf("Failed to load previous snapshot %v from kopia, fallback to full backup", parentSnapshot)
} else {
previous = append(previous, mani)
}
previous = append(previous, mani)
} else {
log.Infof("Searching for parent snapshot")

View File

@@ -112,7 +112,7 @@ func TestSnapshotSource(t *testing.T) {
notError: true,
},
{
name: "failed to load snapshot",
name: "failed to load snapshot, should fallback to full backup and not error",
args: []mockArgs{
{methodName: "LoadSnapshot", returns: []interface{}{manifest, errors.New("failed to load snapshot")}},
{methodName: "SaveSnapshot", returns: []interface{}{manifest.ID, nil}},
@@ -122,7 +122,7 @@ func TestSnapshotSource(t *testing.T) {
{methodName: "Upload", returns: []interface{}{manifest, nil}},
{methodName: "Flush", returns: []interface{}{nil}},
},
notError: false,
notError: true,
},
{
name: "failed to save snapshot",