Skip to content

CON-589: postgres_cdc: allow an externally managed publication - #5000

Merged
squiidz merged 25 commits into
jira/CON-589-default-modefrom
jira/CON-589
Nov 5, 2026
Merged

squiidz merged 25 commits into
jira/CON-589-default-modefrom
jira/CON-589

Conversation

@squiidz

@squiidz squiidz commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds a self_manage_publication option to postgres_cdc (default true). When false, the input validates a DBA-owned publication and never alters it: on every connect it checks that the publication exists, publishes inserts, updates and deletes, and covers every configured table and the signal table, and fails naming whatever is missing. A partitioned table counts as covered only when every leaf partition is published, directly or through an ancestor. The check needs PostgreSQL 12 or later, and the input fails fast on older servers in this mode.

While the input runs, the monitor repeats the coverage check every wal_monitor_interval, logs an error when a table leaves the publication, and reports the count in postgres_publication_missing_tables. Tables streamed with a row filter or column list are logged as a warning at connect. Incremental snapshots against an external publication re-check that the table is still published as itself on every signal, on resume and before every chunk, and abort the backfill if it no longer is.

Stacked on #5080, which carries the changes to the default (self_manage_publication: true) behaviour: the publication sync from pg_publication_rel, the FOR ALL TABLES and FOR TABLES IN SCHEMA errors when tables is set, and the published-as-itself backfill check. Review and merge that one first; this PR's diff against it is the external mode only.

Jira: https://redpandadata.atlassian.net/browse/CON-589

Test evidence

End to end: a source container, the connector built from this branch, and a checker for loss, duplicates, per-key order and content.

Run Commit Result Delivered Duplicates Order Throughput
postgres-cdc, killed and restarted mid-stream f6aa669fe (an earlier commit) ✅ pass 3000/3000, 0 lost 0 in order 310 msg/s, p95 lag 1.8 s

Integration tests at f6aa669fe: pglogicalstream ITs pass on both heads; postgresql package ITs pass on #5000

Updated 2026-11-05.

@squiidz
squiidz marked this pull request as ready for review October 21, 2026 15:21
…e, validate publish operations and filters, and watch external publications
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Connect docs check

The docs build passed with this PR's generated docs.

Preview: https://connect-pr-5000--redpanda-connect.netlify.app/connect/home/

This PR changes 2 published pages (6 generated files: 6 changed, 0 added, 0 removed). Review the rendered pages, not only the Go strings.

Page Preview
/connect/components/inputs/pg_stream/ preview
/connect/components/inputs/postgres_cdc/ preview

Per-file diffs and the rendered-HTML findings are in the job summary. Checked at 4484b27.

@vbotbuildovich
vbotbuildovich requested a review from a team October 22, 2026 18:04
@Leward
Leward self-requested a review October 29, 2026 18:45

@Leward Leward left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR does two things: it adds the external mode, and it changes the default mode.

The changes to the default mode are real behavior changes. The publication sync works differently, and the dedup check now rejects more tables.

The changelog is generated from the commit message. After a squash, these changes ship under "allow an externally managed publication". Users of the default mode will not see that their behavior changed.

Can you move the default-mode changes to their own PR, and stack the external mode on top of it? Then each part gets its own commit message, and we can revert one without the other.

@squiidz

squiidz commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

split default-mode changes into their own PR

Split: the default-mode changes (publication sync from pg_publication_rel, the FOR ALL TABLES error, and the backfill check for tables published as themselves) are now in #5080. This PR is stacked on it and only adds self_manage_publication: false. Once #5080 merges, this one retargets to main.

@squiidz
squiidz requested a review from Leward October 29, 2026 20:27
…res_publication_missing_tables, and say changes to a table out of the publication are lost
@squiidz
squiidz requested a review from Leward November 3, 2026 13:47
# Conflicts:
#	internal/impl/postgresql/input_pg_stream.go
@squiidz
squiidz requested a review from Leward November 3, 2026 15:35
…d note the publication check in pg_wal_monitor_interval

@Leward Leward left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR body still says "Stacked on #<PR_A>". Please replace it with #5080.

# Conflicts:
#	internal/impl/postgresql/input_pg_stream.go
#	internal/impl/postgresql/pglogicalstream/incremental_snapshot.go
#	internal/impl/postgresql/pglogicalstream/pglogrepl.go
#	internal/impl/postgresql/pglogicalstream/pglogrepl_test.go
#	internal/impl/postgresql/pglogicalstream/publication_test.go
@squiidz

squiidz commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

The PR body still says "Stacked on #<PR_A>"

Replaced with #5080.

@squiidz
squiidz requested a review from Leward November 5, 2026 17:02
# Conflicts:
#	internal/impl/postgresql/pglogicalstream/pglogrepl.go
@squiidz
squiidz merged commit 10fae5f into main Nov 5, 2026
16 checks passed
@squiidz
squiidz deleted the jira/CON-589 branch November 5, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants