-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: link kv transaction id to sql transaction id #67589
Description
Is your feature request related to a problem? Please describe.
When running many different applications (micro services) against a cockroach cluster it is extremely useful to be able to identify which connection has a lock on a particular row. If a command is blocked by another connection (say it has a long running TXN) currently it is not at all straightforward to identify the connection (and hopefully therefore the particular application) that is causing the block.
Describe the solution you'd like
In Sybase I can run sp_locks to see locks and sp_blocks to see TXN blocking. They report the connection ID and resource locked.
Other dbs provide admin UIs / queries to quickly identify the issue (e.g. sql server )
Perhaps it is possible to implement a command (for example SHOW LOCKS FOR ALL|DATABASE|TABLE <name>) that will return details of all current locks, the impacted range(s)/rows, the associated table, the connection running the SQL.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
We did try a select over crdb_internal.cluster_transactions and cluster_sessions and tables but it wasn't perfect.
Additional context
Add any other context or screenshots about the feature request here.
Jira issue: CRDB-8619