Skip to content

Commit 42b091f

Browse files
committed
activity: add fallback isolation level for statements not in transaction
The change is achieved by retrieving the session default isolation level closes: cockroachdb[#153931](#153931) Epic: None Release note: None
1 parent 4c6b4ce commit 42b091f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/sql/conn_executor.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4450,6 +4450,12 @@ func (ex *connExecutor) serialize() serverpb.Session {
44504450
sql := truncateSQL(query.stmt.SQL)
44514451
progress := math.Float64frombits(atomic.LoadUint64(&query.progressAtomic))
44524452
elapsedTime := crtime.MonoFromTime(timeNow).Sub(query.start)
4453+
var isolationLevel string
4454+
if activeTxnInfo != nil && query.txnID == activeTxnInfo.ID {
4455+
isolationLevel = activeTxnInfo.IsolationLevel
4456+
} else {
4457+
isolationLevel = tree.IsolationLevel(ex.sessionData().DefaultTxnIsolationLevel).String()
4458+
}
44534459
activeQueries = append(activeQueries, serverpb.ActiveQuery{
44544460
TxnID: query.txnID,
44554461
ID: id.String(),
@@ -4465,7 +4471,7 @@ func (ex *connExecutor) serialize() serverpb.Session {
44654471
IsFullScan: query.isFullScan,
44664472
PlanGist: query.planGist,
44674473
Database: query.database,
4468-
IsolationLevel: activeTxnInfo.IsolationLevel,
4474+
IsolationLevel: isolationLevel,
44694475
})
44704476
}
44714477
lastActiveQuery := ""

0 commit comments

Comments
 (0)