cockroachdb / cockroachdb/cockroach
sql: better describe the meaning of crdb_internal.node_transactions content
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
In crdb_internal.node_transactions, the txn string column has a string representation of the txn meta.
In one recent incident, a session was observed in crdb_internal.node_sessions with a particular transaction ID in the `kv_txn` column. The transaction with that ID in crdb_internal.node_transactions had started approximately an hour prior but in the txn string, it showed `stat=COMMITTED`. This was surprising and confusing to some of us, who were under the impression that the txn listed in the kv_txn column of the session table is the current _open_ transaction, for example if user has explicitly started one with BEGIN and not committed it or it is running a statement in an implicit txn, which it wasn't -- the session row said it was IDLE and there were no active queries.
Observed on version 22.2. More context in internal slack thread: https://cockroachlabs.slack.com/archives/C0168LW5THS/p1673367606040759?thread_ts=1673366965.043409&cid=C0168LW5THS
Jira issue: CRDB-23280
Epic CRDB-60942
Contributor guide
Research direction
Start by reading the definitions and existing documentation for crdb_internal.node_transactions and crdb_internal.node_sessions, focusing on the txn and kv_txn columns and the transaction state shown in txn. Use the incident described in the issue to verify the behavior, then document what each value represents and why an IDLE session can correspond to a transaction showing stat=COMMITTED.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100