pgsql: Add a failover option to subscriptions.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add a failover option to subscriptions.
Date: 2024-01-30 11:31:45
Message-ID: E1rUmLB-003ptW-UP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add a failover option to subscriptions.

This commit introduces a new subscription option named 'failover', which
provides users with the ability to set the failover property of the
replication slot on the publisher when creating or altering a
subscription.

This uses the replication commands introduced by commit 7329240437 to
enable the failover option for a logical replication slot.

If the failover option is set to true, the associated replication slots
(i.e. the main slot and the table sync slots) in the upstream database are
enabled to be synchronized to the standbys. Note that the capability to
sync the replication slots will be added in subsequent commits.

Thanks to Masahiko Sawada for the design inputs.

Author: Shveta Malik, Hou Zhijie, Ajin Cherian
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda Hayato, Amit Kapila
Discussion: https://postgr.es/m/514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/776621a5e4796fa214b6b29a7ca134f6c138572a

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 11 ++
doc/src/sgml/ref/alter_subscription.sgml | 25 +++-
doc/src/sgml/ref/create_subscription.sgml | 23 ++-
doc/src/sgml/ref/pg_dump.sgml | 8 +-
src/backend/catalog/pg_subscription.c | 1 +
src/backend/catalog/system_views.sql | 2 +-
src/backend/commands/subscriptioncmds.c | 116 +++++++++++++++-
src/backend/replication/logical/tablesync.c | 2 +-
src/backend/replication/logical/worker.c | 7 +
src/bin/pg_dump/pg_dump.c | 21 ++-
src/bin/pg_dump/pg_dump.h | 1 +
src/bin/pg_upgrade/t/003_logical_slots.pl | 6 +-
src/bin/pg_upgrade/t/004_subscription.pl | 18 +--
src/bin/psql/describe.c | 8 +-
src/bin/psql/tab-complete.c | 4 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_subscription.h | 9 ++
src/test/recovery/meson.build | 1 +
.../recovery/t/040_standby_failover_slots_sync.pl | 100 +++++++++++++
src/test/regress/expected/subscription.out | 154 +++++++++++----------
src/test/regress/sql/subscription.sql | 1 +
21 files changed, 412 insertions(+), 108 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2024-01-30 17:13:02 pgsql: Split use of SerialSLRULock, creating SerialControlLock
Previous Message Daniel Gustafsson 2024-01-30 10:28:20 pgsql: pgcrypto: Fix check for buffer size