Add a failover option to subscriptions.
authorAmit Kapila <akapila@postgresql.org>
Tue, 30 Jan 2024 11:01:09 +0000 (16:31 +0530)
committerAmit Kapila <akapila@postgresql.org>
Tue, 30 Jan 2024 11:19:28 +0000 (16:49 +0530)
commit776621a5e4796fa214b6b29a7ca134f6c138572a
treeba58dcb69a247bc073eca865879e730c5790ce3a
parentb527ebc1d37aa82b771dc9c76111bed1bce35a05
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
21 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/ref/alter_subscription.sgml
doc/src/sgml/ref/create_subscription.sgml
doc/src/sgml/ref/pg_dump.sgml
src/backend/catalog/pg_subscription.c
src/backend/catalog/system_views.sql
src/backend/commands/subscriptioncmds.c
src/backend/replication/logical/tablesync.c
src/backend/replication/logical/worker.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_upgrade/t/003_logical_slots.pl
src/bin/pg_upgrade/t/004_subscription.pl
src/bin/psql/describe.c
src/bin/psql/tab-complete.c
src/include/catalog/catversion.h
src/include/catalog/pg_subscription.h
src/test/recovery/meson.build
src/test/recovery/t/040_standby_failover_slots_sync.pl [new file with mode: 0644]
src/test/regress/expected/subscription.out
src/test/regress/sql/subscription.sql