Skip to content

Commit 2897250

Browse files
committed
Merge branch 'main' into refactor/snapshot-embedded-containerd
Signed-off-by: Robbie Buxton <[email protected]>
2 parents 209aaf5 + 45af8ff commit 2897250

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

snapshot/snapshot.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ func (o *snapshotter) commit(ctx context.Context, isRemote bool, name, key strin
316316
return err
317317
}
318318

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

346+
rollback = false
345347
return t.Commit()
346348
}
347349

0 commit comments

Comments
 (0)