-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: add new SQL grammar for consistency checking via INSPECT command #148272
Copy link
Copy link
Closed
Labels
A-sql-scrubC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Description
This task introduces new SQL grammar for a INSPECT command that supports data consistency validation. It serves as an alternative to the existing EXPERIMENTAL SCRUB command. While SCRUB was originally framed around hardware error correction concepts (see RFC), the new INSPECT command aims to present a clearer and more intuitive interface focused on validation, not repair. Since consistency issues are expected to be rare, the emphasis is on confirming integrity.
This issue is focused on defining the grammar and plumbing. Execution will be gated behind a feature flag and initially implemented as a no-op.
Proposed SQL Syntax
INSPECT TABLE <table> [AS OF SYSTEM TIME <expr>] [WITH OPTIONS (<option> [, ...])]
INSPECT DATABASE <database> [AS OF SYSTEM TIME <expr>] [WITH OPTIONS (<option> [, ...])]
SHOW INSPECT FAILURES [FOR TABLE <name>] [FOR LATEST RUN] [WITH DETAILS]
Options:
INDEX ALL— Validates all indexes (default).INDEX (<indexname>...)— Run an inspect against the specific indexes
These options are mutually exclusive.
Scope of This Task
- Add grammar for INSPECT and SHOW INSPECT FAILURES.
- Introduce a cluster setting
enable_inspect_commandinvars.go. - By default,
INSPECTfails with an error message referencing the setting. - If enabled,
INSPECTwill return successfully as a no-op. SHOW INSPECT FAILURESwill always return successfully as a no-opEXPERIMENTAL SCRUBremains available. Execution logic forINSPECTwill be implemented in follow-up tasks.
Jira issue: CRDB-51507
Epic CRDB-30356
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-scrubC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)