Skip to content

feat(resharding): add validation step for schema_sync - #1692

Merged
meskill merged 1 commit into
mainfrom
meskill-2026-09-25-feat-resharding---qwpy
Sep 29, 2026
Merged

meskill merged 1 commit into
mainfrom
meskill-2026-09-25-feat-resharding---qwpy

Conversation

@meskill

@meskill meskill commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Add a new PostDataValidation phase for schema_sync that allows to run the validation after copying the data. Previously in #1540 the FK constraints where added with NOT VALID option marking the flag convalidated = false for the related table, which disables the check on creation for existing data and maybe disables some optimization that could be done by db for this table.

New step runs VALIDATE CONSTRAINT on this FK to make sure the convalidated is set to true on table and the db actually will start to think the values are validated. Like this since it should not block the table from actual writes comparing with creating the FK without options, so we can run this in parallel to our replication process.

The check is manual for now and later PRs will use them to run during validation.

For the remainder of the flow:

  • we copy tables with COPY command
  • we create FK constraints with NOT VALID since the copied data could be not in sync because different tables were copied at different snapshot time
  • we replicate changes - eventually, data "should" become synchronized and valid
  • the PostDataValidation could be run after the replication or after some time during the replication to see if there any errors.

@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.18033% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pgdog/src/cli.rs 98.21% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@meskill
meskill added this pull request to stack #1694 September 29, 2026 14:23
@meskill
meskill force-pushed the meskill-2026-09-25-feat-resharding---qwpy branch from aeca536 to 0a1be86 Compare September 29, 2026 15:02

@levkk levkk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@meskill
meskill added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 9fecdf3 Sep 29, 2026
38 checks passed
@meskill
meskill deleted the meskill-2026-09-25-feat-resharding---qwpy branch September 29, 2026 18:30
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