Skip to content

Changefeed perturbation test#164374

Draft
rharding6373 wants to merge 2 commits intocockroachdb:masterfrom
rharding6373:changefeed-perturbation-test
Draft

Changefeed perturbation test#164374
rharding6373 wants to merge 2 commits intocockroachdb:masterfrom
rharding6373:changefeed-perturbation-test

Conversation

@rharding6373
Copy link
Copy Markdown
Collaborator

changefeedccl: add randomized perturbation test for changefeeds

Add a new randomized perturbation test (TestChangefeedPerturbation) that
exercises changefeeds with random table schemas, random DML operations,
random schema changes that trigger backfills, and system perturbations
(pause/resume, splits, transaction push/abort).

The test uses randgen.RandColumnType to generate diverse column types,
filters for changefeed-safe types, and validates ordering and delivery
guarantees using OrderValidator, TopicValidator, and conditionally
MvccTimestampValidator and KeyInValueValidator.

Key features:
- Random table schemas with 2-8 non-PK columns of diverse SQL types
- Weighted random event loop with DML, schema changes, and perturbations
- Schema changes that trigger backfills (ADD COLUMN with DEFAULT, STORED
  computed columns, NOT NULL constraints; DROP COLUMN)
- Drain phase that validates expected row delivery after the event loop,
  catching bugs where backfills are silently skipped
- Duplicate message detection across pause/resume and range splits
- DECIMAL type excluded due to JSON parsing issues with large exponents

Epic: none
Release note: None

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rharding6373 and others added 2 commits February 23, 2026 11:39
Add a new randomized perturbation test (TestChangefeedPerturbation) that
exercises changefeeds with random table schemas, random DML operations,
random schema changes that trigger backfills, and system perturbations
(pause/resume, splits, transaction push/abort).

The test uses randgen.RandColumnType to generate diverse column types,
filters for changefeed-safe types, and validates ordering and delivery
guarantees using OrderValidator, TopicValidator, and conditionally
MvccTimestampValidator and KeyInValueValidator.

Key features:
- Random table schemas with 2-8 non-PK columns of diverse SQL types
- Weighted random event loop with DML, schema changes, and perturbations
- Schema changes that trigger backfills (ADD COLUMN with DEFAULT, STORED
  computed columns, NOT NULL constraints; DROP COLUMN)
- Drain phase that validates expected row delivery after the event loop,
  catching bugs where backfills are silently skipped
- Duplicate message detection across pause/resume and range splits
- DECIMAL type excluded due to JSON parsing issues with large exponents

Epic: none
Release note: None

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add optional column family support to the perturbation test. When
enabled (50% of the time), the table is created with two column
families and the changefeed targets each family explicitly. This
exercises a different code path in the schema feed's column-drop
detection (droppedColumnIsWatched) that was involved in cockroachdb#149861.

Column family interactions require adjustments to event counting:
- Each DML operation produces one event per family
- Families with all-NULL columns have no KV entry and produce no event
- The drain phase subtracts maximum possible overcounting before
  validating row delivery

Epic: none
Release note: None

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented Feb 25, 2026

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented Feb 25, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants