schemachanger: fix flaky DML injection test for drop column with NOT NULL#164535
schemachanger: fix flaky DML injection test for drop column with NOT NULL#164535bghal wants to merge 2 commits intocockroachdb:masterfrom
Conversation
…NULL When dropping a NOT NULL column, the schema changer converts the native NOT NULL constraint into a synthetic CHECK constraint (`j IS NOT NULL`) during PreCommitPhase. With metamorphic locked leasing enabled (~90% of test runs), the DML injection's implicit transaction may acquire a lease on the pre-PreCommitPhase descriptor where the column still has `nullable=false` and no CHECK constraint. This produces the error "null value in column \"j\" violates not-null constraint" instead of the expected "failed to satisfy CHECK constraint (j IS NOT NULL)". Both error messages correctly enforce the NOT NULL semantics — the difference is only which code path catches the violation (native NOT NULL check vs. synthetic CHECK constraint). Update the expected error regex to accept either variant. Fixes: cockroachdb#160985 Release note: None Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
|
Merging to
|
Fix "diable" → "disable" in `disableLeasedDescriptorsByDefaultThreshold` and "descrptor" → "descriptors" in the `UseLeasedDescriptorsForCatalogDefault` comment. Release note: None Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
fqazi
left a comment
There was a problem hiding this comment.
@fqazi made 1 comment.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on bghal).
pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_null_constraint/drop_column_with_null_constraint.definition line 11 at r1 (raw file):
INSERT INTO t (i) VALUES($stageKey); ---- pq: (failed to satisfy CHECK constraint \(j IS NOT NULL\)|null value in column "j" violates not-null constraint)
We are supposed to have a WaitForOneVersion operation, so this is surprising. Is it easy to reproduce?
fqazi
left a comment
There was a problem hiding this comment.
@fqazi made 1 comment.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on bghal).
pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_null_constraint/drop_column_with_null_constraint.definition line 11 at r1 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
We are supposed to have a WaitForOneVersion operation, so this is surprising. Is it easy to reproduce?
If you can reproduce it can you try with the session variable: catalog_digest_staleness_check_enabled set to false.
bghal
left a comment
There was a problem hiding this comment.
@bghal made 1 comment.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on fqazi).
pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_null_constraint/drop_column_with_null_constraint.definition line 11 at r1 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
If you can reproduce it can you try with the session variable:
catalog_digest_staleness_check_enabledset to false.
Yeah can repro with enough runs.
Summary
TestExecuteWithDMLInjection_drop_column_with_null_constraintby accepting both NOT NULL error message variants in the expected error regex.pkg/sql/catalog/lease/lease.go:diable→disablein variable name,descrptor→descriptorsin comment.Fixes: #160985
Release note: None