cockroachdb / cockroachdb/cockroach
sql: show-stats doesn't work when the table is offline
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
While an import job is running, the table is taken offline to prevent concurrent access. The SHOW STATISTICS command attempts to retrieve the table descriptor in order to check privileges and use table ID for the stats lookup. This is done through `ResolveUncachedTableDescriptorEx`, which returns an error when it finds an offline table. This is a poor user experience since it's unexpected that an import would conflict with viewing stats that were previously gathered. We should consider whether it's possible to change this behavior for SHOW STATISTICS and similar commands. At first glance it seems like this should be possible, since the table is not mutated, nor is its data read.
Reproduction is simple - just attempt to use the `SHOW STATISTICS` command on a table while an import job is running.
Jira issue: CRDB-30526
Contributor guide
Assessment
This issue has not been assessed yet.