Skip to content

fix(cdc): retry pending subscriptions after publication refresh - #2460

Open
hsusul wants to merge 2 commits into
supabase:mainfrom
hsusul:fix/cdc-publication-refresh-inflight
Open

hsusul wants to merge 2 commits into
supabase:mainfrom
hsusul:fix/cdc-publication-refresh-inflight

Conversation

@hsusul

@hsusul hsusul commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Why

Closes #2459.

A publication refresh can delete a successful Postgres Changes subscription before the manager handles its registration message. The connected client then misses changes without a retry request.

What changed

  • Send the existing retry message through the tenant's CDC PubSub topic, which channels join before SQL registration.
  • Keep the existing SQL, monitor, and ETS cleanup.
  • Cover explicit and wildcard subscriptions across the refresh, restored database rows, and tenant isolation.

Scope

This covers publication refresh notifications. Manager startup and database subscription insertion retain their existing behavior.

Blast radius

A publication change asks all channels on that tenant's CDC topic to retry, including registrations still in flight. The existing channel handler cancels its retry timer and upserts the same subscription IDs.

Verification

  • Both regressions failed upstream at the missing retry assertion and passed with the fix. The standalone issue reproduction also failed upstream and passed fixed.
  • CDC and PubSub checks passed with 12 doctests and 290 tests. Six Docker or synchronous-standby tests were excluded.
  • Format, dev and test compilation with warnings as errors, strict Credo, unused dependencies, Sobelow, Dialyzer, and git diff --check passed.

Local checks used Elixir 1.19.5, OTP 28.5.0.8, and PostgreSQL 17.11. The full application suite and CI Docker matrix were not run locally.

This branch has not been deployed

No deployments
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.

Publication refresh can remove a successful Postgres Changes subscription without retrying it

1 participant