Skip to content

Commit

Permalink
*: fix resource leak in select for update when 'tidb_low_resolution_t…
Browse files Browse the repository at this point in the history
…so' is set (#57012) (#57367)

close #55468
  • Loading branch information
ti-chi-bot authored Nov 21, 2024
1 parent 2ed426a commit d805053
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error) {

if a.isSelectForUpdate {
if sctx.GetSessionVars().UseLowResolutionTSO() {
terror.Log(exec.Close(e))
return nil, errors.New("can not execute select for update statement when 'tidb_low_resolution_tso' is set")
}
// Special handle for "select for update statement" in pessimistic transaction.
Expand All @@ -614,6 +615,7 @@ func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error) {
var txnStartTS uint64
txn, err := sctx.Txn(false)
if err != nil {
terror.Log(exec.Close(e))
return nil, err
}
if txn.Valid() {
Expand Down

0 comments on commit d805053

Please sign in to comment.