From e117cfb2f6c67fe4ba46720bc6917da3dbd48c10 Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Wed, 26 Feb 2025 11:12:50 +0530 Subject: Add two-phase option in pg_createsubscriber. This patch introduces the '--enable-two-phase' option to the 'pg_createsubscriber' utility, allowing users to enable two-phase commit for all subscriptions during their creation. Note that even without this option users can enable the two_phase option for the subscriptions created by pg_createsubscriber. However, it requires the subscription to be disabled first which could be inconvenient for users. When two-phase commit is enabled, prepared transactions are sent to the subscriber at the time of 'PREPARE TRANSACTION', and they are processed as two-phase transactions on the subscriber as well. If disabled, prepared transactions are sent only when committed and are processed immediately by the subscriber. Author: Shubham Khanna Reviewed-by: vignesh C Reviewed-by: Hayato Kuroda Reviewed-by: Peter Smith Reviewed-by: Ajin Cherian Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CAHv8RjLPdFP=kA5LNSmWZ=+GMXmO+LczvV6p9HJjsXxZz10KGA@mail.gmail.com --- doc/src/sgml/ref/pg_createsubscriber.sgml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/pg_createsubscriber.sgml b/doc/src/sgml/ref/pg_createsubscriber.sgml index d56487fe2ca..65caa3f5095 100644 --- a/doc/src/sgml/ref/pg_createsubscriber.sgml +++ b/doc/src/sgml/ref/pg_createsubscriber.sgml @@ -165,6 +165,19 @@ PostgreSQL documentation + + + + + + Enables two_phase + commit for the subscription. When multiple databases are specified, this + option applies uniformly to all subscriptions created on those databases. + The default is false. + + + + @@ -300,7 +313,9 @@ PostgreSQL documentation greater than or equal to the number of specified databases. The target server must have configured to a value greater than the number of specified databases. The target server - must accept local connections. + must accept local connections. If you are planning to use the + switch then you will also need to set + the appropriately. @@ -360,6 +375,7 @@ PostgreSQL documentation + Unless the switch is specified, pg_createsubscriber sets up logical replication with two-phase commit disabled. This means that any prepared transactions will be replicated at the time -- cgit v1.2.3