cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

sql/schemachanger: Enable adding/dropping path of check constraint

Open Xiang-Gu opened this issue 3 years ago • 1 comments

Previously, we emit unimplemented operations on the adding and dropping path of check constraint and constraint name. This PR enables this feature as it will unblock certain DDL statement in the declarative schema changer such as ALTER PRIMARY KEY USING HASH.

The two most notable changes are (commit 4 and commit 5): 1). Implemented the logic to validate a check constraint in backfill.go and plumb it in to the Validator used in declarative schema changer for unique index and check constraint validation.

2). Introduced two new status -- Check_Constraint_Validating and Check_Constraint_Validated, and the the adding/dropping path of a check constraint is now ABSENT <--> VALIDATING <--> VALIDATED <--> PUBLIC

Xiang-Gu avatar Aug 09 '22 18:08 Xiang-Gu

This change is Reviewable

cockroach-teamcity avatar Aug 09 '22 18:08 cockroach-teamcity

RFAL!

Xiang-Gu avatar Aug 11 '22 14:08 Xiang-Gu

Let's table this until the next release. This was a valiant and impressive effort, but time has run out.

If it's any consolation, we experienced something similar in the last cycle with ADD COLUMN. We thought we were so close! Retrospectively, I'm glad we gave that the proper treatment it deserved in the subsequent (current) release cycle. I'm having similar gut feelings here for constraints in general.

Also, who knows what unknown problems the hash-sharding will reveal, and that's all still to be done.

postamar avatar Aug 13 '22 12:08 postamar

I'm going to close this in favor of a sequence of smaller PRs, as tracked in issue https://github.com/cockroachdb/cockroach/issues/89665

Xiang-Gu avatar Oct 24 '22 15:10 Xiang-Gu