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 <[email protected]>
Author: vignesh C <[email protected]>
Reviewed-by: Hayato Kuroda <[email protected]>
Reviewed-by: Amit Kapila <[email protected]>
Backpatch-through: 19, where it was introduced
Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_19_STABLE

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

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(-)

Reply via email to