Skip to content

Commit

Permalink
Merge branch 'main' into refactor/snapshot-embedded-containerd
Browse files Browse the repository at this point in the history
Signed-off-by: Robbie Buxton <138501839+rbpdt@users.noreply.github.com>
  • Loading branch information
rbpdt committed Aug 11, 2023
2 parents 209aaf5 + 45af8ff commit 2897250
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ func (o *snapshotter) commit(ctx context.Context, isRemote bool, name, key strin
return err
}

rollback := true
defer func() {
if err != nil {
if rollback {
if rerr := t.Rollback(); rerr != nil {
log.G(ctx).WithError(rerr).Warn("failed to rollback transaction")
}
Expand All @@ -342,6 +343,7 @@ func (o *snapshotter) commit(ctx context.Context, isRemote bool, name, key strin
return fmt.Errorf("failed to commit snapshot: %w", err)
}

rollback = false
return t.Commit()
}

Expand Down

0 comments on commit 2897250

Please sign in to comment.