mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -1430,7 +1430,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
|
||||
*/
|
||||
walrcv_create_slot(LogRepWorkerWalRcvConn,
|
||||
slotname, false /* permanent */ , false /* two_phase */ ,
|
||||
false,
|
||||
MySubscription->failover,
|
||||
CRS_USE_SNAPSHOT, origin_startpos);
|
||||
|
||||
/*
|
||||
|
@ -132,6 +132,13 @@
|
||||
* avoid such deadlocks, we generate a unique GID (consisting of the
|
||||
* subscription oid and the xid of the prepared transaction) for each prepare
|
||||
* transaction on the subscriber.
|
||||
*
|
||||
* FAILOVER
|
||||
* ----------------------
|
||||
* The logical slot on the primary can be synced to the standby by specifying
|
||||
* failover = true when creating the subscription. Enabling failover allows us
|
||||
* to smoothly transition to the promoted standby, ensuring that we can
|
||||
* subscribe to the new primary without losing any data.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
Reference in New Issue
Block a user