Skip to content

Commit

Permalink
issue 7094: fallback to full backup if previous snapshot is not found
Browse files Browse the repository at this point in the history
Signed-off-by: Lyndon-Li <[email protected]>
  • Loading branch information
Lyndon-Li committed Nov 14, 2023
1 parent 86e34ee commit 84d8bbd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/7097-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #7094, fallback to full backup if previous snapshot is not found
6 changes: 3 additions & 3 deletions pkg/uploader/kopia/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions pkg/uploader/kopia/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
Expand All @@ -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",
Expand Down

0 comments on commit 84d8bbd

Please sign in to comment.