Skip to content

Commit

Permalink
Merge #92408
Browse files Browse the repository at this point in the history
92408: sql: fix implicit txn flag in console r=maryliag a=rafiss

See: https://cockroachlabs.slack.com/archives/CPD3ANLMB/p1669224473591659
Epic: none

Release note (bug fix): Fixed the statement activity page so that it no longer shows multi-statement implicit transactions as "explicit."

Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
craig[bot] and rafiss committed Nov 23, 2022
2 parents b04c3b0 + fbefe42 commit b6c1555
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pkg/sql/conn_executor_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -1117,8 +1117,7 @@ func (ex *connExecutor) dispatchToExecutionEngine(

// include gist in error reports
ctx = withPlanGist(ctx, planner.instrumentation.planGist.String())

if planner.autoCommit {
if planner.extendedEvalCtx.TxnImplicit {
planner.curPlan.flags.Set(planFlagImplicitTxn)
}

Expand Down
13 changes: 7 additions & 6 deletions pkg/sql/logictest/testdata/logic_test/statement_statistics
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ select 1, 2; select 1, 2, 3; select 'ok'
statement ok
SET application_name = ''

query T
SELECT txn_fingerprint_id FROM crdb_internal.node_statement_statistics WHERE application_name = 'multi_stmts_test' ORDER BY txn_fingerprint_id
query TTB
SELECT txn_fingerprint_id, key, implicit_txn FROM crdb_internal.node_statement_statistics WHERE application_name = 'multi_stmts_test' ORDER BY txn_fingerprint_id
----
10413021493801724718
10413021493801724718
10413021493801724718
17854018046052698166
10659166962890673102 SELECT '_' true
10659166962890673102 SELECT _, _ true
10659166962890673102 SELECT _, _, _ true
17854018046052698166 SET application_name = '_' true

statement ok
CREATE TABLE test(x INT, y INT, z INT); INSERT INTO test(x, y, z) VALUES (0,0,0);
Expand Down Expand Up @@ -256,6 +256,7 @@ ORDER BY key, implicit_txn;
----
key implicit_txn
SELECT _ false
SELECT _ true
SELECT x FROM test WHERE y = _ false
SELECT x FROM test WHERE y = _ false
SELECT x FROM test WHERE y = _ true
Expand Down

0 comments on commit b6c1555

Please sign in to comment.