Skip to content

Commit

Permalink
sql: record transaction idle time during rollback
Browse files Browse the repository at this point in the history
Transaction idle time is recorded when we execute the next statement,
including COMMIT. The ROLLBACK path was not doing so, this fixes that.

Epic: none
Release note: none
  • Loading branch information
mw5h committed Feb 28, 2025
1 parent 5bb2161 commit 2608d5c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/sql/conn_executor_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,9 @@ func (ex *connExecutor) createJobs(ctx context.Context) error {
func (ex *connExecutor) rollbackSQLTransaction(
ctx context.Context, stmt tree.Statement,
) (fsm.Event, fsm.EventPayload) {
ex.extraTxnState.idleLatency += ex.statsCollector.PhaseTimes().
GetIdleLatency(ex.statsCollector.PreviousPhaseTimes())

if err := ex.extraTxnState.sqlCursors.closeAll(&ex.planner, cursorCloseForTxnRollback); err != nil {
return ex.makeErrEvent(err, stmt)
}
Expand Down

0 comments on commit 2608d5c

Please sign in to comment.