cockroachdb / cockroachdb/cockroach
inspect: add concurrency control to limit simultaneous INSPECT executions
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
## Summary
There is currently no mechanism to control how many INSPECT statements can execute concurrently. When a large number of INSPECTs are triggered in a short window, some number can be in-flight simultaneously with no upper bound. Each running INSPECT allocates a SQL session and sets up a Protected Timestamp (PTS) record, so running too many concurrently can put excessive pressure on memory and contend on the `system.protected_ts_meta` hot key.
This came up in the context of the large schema benchmark, where async row count validation after importing ~40,000 tables results in a large number of INSPECTs being queued in a short timeframe. The benchmark failure is being addressed separately; this issue tracks the broader need to give INSPECT some form of concurrency control so that the system is not overwhelmed when many INSPECTs are triggered at once.
## Next Steps
- [ ] Investigate where and how concurrency control should be enforced for INSPECT
- [ ] Determine whether the limit should be configurable
## Context
Discussion: https://cockroachlabs.slack.com/archives/GQ5GJ1ELB/p1773174720663249
Jira issue: CRDB-61557
Epic CRDB-58926
Contributor guide
Assessment
This issue has not been assessed yet.