Skip to content

Commit

Permalink
release snapshot on all error paths in AcquireReadConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
k-anshul committed Feb 4, 2025
1 parent af9a570 commit 74137aa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runtime/pkg/rduckdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,13 @@ func (d *db) AcquireReadConnection(ctx context.Context) (*sqlx.Conn, func() erro

conn, err := d.dbHandle.Connx(ctx)
if err != nil {
d.catalog.releaseSnapshot(snapshot)
return nil, nil, err
}

err = d.prepareSnapshot(ctx, conn, snapshot)
if err != nil {
d.catalog.releaseSnapshot(snapshot)
_ = conn.Close()
return nil, nil, err
}
Expand Down

0 comments on commit 74137aa

Please sign in to comment.