-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32504: sql: run check constraint mutations and validation by schema changer r=lucy-zhang a=eriktrinh This change moves check constraint adds and drops through the schema changer when the transaction commits, moving the constraint through the same intermediate states as when index/columns are added or dropped. The only small differences are: - Constraint adds can start in write-only and immediately start being enforced if all used columns are in write-only or public. - Constraint drops can move immediately from public to absent if they have not yet been validated. Therefore, the check constraint is no longer immediately public when it is added, but allows data validation of the constraint to be performed when the constraint is added (and is now the default behaviour). Constraints can now also be added on columns in the process of being added. This change also ensures that there are no data anomalies in either versions of the schema when dropping a validated check constraint, as previously the transition moved the constraint from public -> absent. Writes on the new version were not being checked even though nodes on an older version expect all rows to conform to the constraint. Release note (sql change): Check constraint adds by default will validate table data with the added constraint asynchronously after the transaction commits. Co-authored-by: Erik Trinh <erik@cockroachlabs.com>
- Loading branch information
Showing
20 changed files
with
1,333 additions
and
659 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.