You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
149503: sql: include txn retry info into SHOW QUERIES r=yuzefovich a=yuzefovich
This commit attempts to make txn retry information more visible. We already expose the number of times the txn is retried via `num_retries` and `num_auto_retries` columns of `{cluster,node}_transactions` virtual tables. However, at least for me personally, SHOW QUERIES is often the first entry point to understand what's happening on the cluster right now, and I don't always remember that there might retries going on when a given query has been running for a long time. To make that jump quicker we now include `num_txn_retries` and `num_txn_auto_retries` into the output of SHOW QUERIES (as well as the virtual table that it's powered by).
Note that this might be a source of confusion in multi-stmt transactions because for each active query we'll print the number of txn retries regardless of which stmt encountered the retry. Still, it seems better than having to remember to join against the transactions virtual table on the session ID, plus we avoid possible fanout since we already have the necessary information in protos when populating the active queries.
Also note that I believe we don't need to do anything special for the mixed version state since the virtual table scans prohibits the query distribution, meaning that if new columns are requested for SHOW QUERIES, then we're on a new binary and it knows how to populate them (even if the proto response came from the older node).
Fixes: #148842.
Release note (sql change): New columns `num_txn_retries` and `num_txn_auto_retries` are included into
`crdb_internal.{cluster,node}_queries` virtual tables as well as output of SHOW QUERIES. These columns, when not NULL, have the same information as `num_retries` and `num_auto_retries` columns of `crdb_internal.{cluster,node}_transactions` virtual tables for the same transaction in which the active query is executed.
Co-authored-by: Yahor Yuzefovich <[email protected]>
0 commit comments