pgsql: Fix issues in logical replication sequence synchronization.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix issues in logical replication sequence synchronization.
Date: 2026-07-27 03:45:19
Message-ID: E1woCHH-00000000T5g-1AyW@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix issues in logical replication sequence synchronization.

1. Stop a running sequence synchronization worker when
ALTER SUBSCRIPTION ... DISABLE is executed. The worker did not reread its
subscription after starting a transaction, so it kept running with a stale
copy and missed the disable. It now calls maybe_reread_subscription()
after StartTransactionCommand(), matching the apply worker.

2. Restore the invariant that publisher-side synchronization slots are
dropped last during ALTER SUBSCRIPTION ... REFRESH PUBLICATION. The
slot-drop loop now runs after the sequence-removal loop, so the
non-transactional slot drops happen only after all catalog changes that
could still be rolled back on error.

3. Restore psql tab completion for
ALTER SUBSCRIPTION ... REFRESH PUBLICATION WITH (.

4. Make pg_stat_subscription report NULL for the fields that do not apply
to a sequence synchronization worker, which does not stream from a
walsender, and update the documentation accordingly.

5. Update the pg_subscription_rel.srsublsn catalog documentation to
describe its semantics for sequence rows.

Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Author: vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Backpatch-through: 19, where it was introduced
Discussion: https://postgr.es/m/20260710045217.f0.noahmisch@microsoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b8d9cf512c1259f97f9896593cc1c8352c1118ac

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 6 ++-
doc/src/sgml/monitoring.sgml | 19 +++++----
src/backend/commands/subscriptioncmds.c | 56 +++++++++++++-------------
src/backend/replication/logical/sequencesync.c | 2 +
src/backend/replication/logical/worker.c | 14 ++++++-
src/bin/psql/tab-complete.in.c | 3 ++
6 files changed, 61 insertions(+), 39 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-07-27 13:08:35 pgsql: pg_resetwal: do not allow zero next multixact offset
Previous Message Richard Guo 2026-07-27 01:22:42 pgsql: Fix deparsing of JSON_ARRAY(subquery) with a FORMAT clause