Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 07fbecb

Browse files
author
Amit Kapila
committed
Doc: Fix the mistakes in the subscription's failover option.
The documentation incorrectly stated that users could not alter the subscription's failover option when the two-phase commit is enabled. The steps to confirm that the standby server is ready for failover were incorrect. Author: Shveta Malik, Hou Zhijie Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/OS0PR01MB571657B72F8D75BD858DCCE394AD2@OS0PR01MB5716.jpnprd01.prod.outlook.com Discussion: https://postgr.es/m/CAJpy0uBBk+OZXXqQ00Gai09XR+mDi2=9sMBYY0F+BedoFivaMA@mail.gmail.com
1 parent f6bef36 commit 07fbecb

File tree

2 files changed

+44
-24
lines changed

2 files changed

+44
-24
lines changed

doc/src/sgml/logical-replication.sgml

+38-23
Original file line numberDiff line numberDiff line change
@@ -725,32 +725,45 @@ ALTER SUBSCRIPTION
725725
<procedure>
726726
<step performance="required">
727727
<para>
728-
On the subscriber node, use the following SQL to identify which slots
729-
should be synced to the standby that we plan to promote. This query will
730-
return the relevant replication slots, including the main slots and table
731-
synchronization slots associated with the failover-enabled subscriptions.
732-
Note that the table sync slot should be synced to the standby server only
733-
if the table copy is finished (See <xref linkend="catalog-pg-subscription-rel"/>).
728+
On the subscriber node, use the following SQL to identify which replication
729+
slots should be synced to the standby that we plan to promote. This query
730+
will return the relevant replication slots associated with the
731+
failover-enabled subscriptions.
732+
<programlisting>
733+
test_sub=# SELECT
734+
array_agg(quote_literal(s.subslotname)) AS slots
735+
FROM pg_subscription s
736+
WHERE s.subfailover AND
737+
s.subslotname IS NOT NULL;
738+
slots
739+
-------
740+
{'sub1','sub2','sub3'}
741+
(1 row)
742+
</programlisting></para>
743+
</step>
744+
<step performance="required">
745+
<para>
746+
On the subscriber node, use the following SQL to identify which table
747+
synchronization slots should be synced to the standby that we plan to promote.
748+
This query needs to be run on each database that includes the failover-enabled
749+
subscription(s). Note that the table sync slot should be synced to the standby
750+
server only if the table copy is finished
751+
(See <xref linkend="catalog-pg-subscription-rel"/>).
734752
We don't need to ensure that the table sync slots are synced in other scenarios
735753
as they will either be dropped or re-created on the new primary server in those
736754
cases.
737755
<programlisting>
738756
test_sub=# SELECT
739-
array_agg(slot_name) AS slots
757+
array_agg(quote_literal(slot_name)) AS slots
740758
FROM
741-
((
742-
SELECT r.srsubid AS subid, CONCAT('pg_', srsubid, '_sync_', srrelid, '_', ctl.system_identifier) AS slot_name
759+
(
760+
SELECT CONCAT('pg_', srsubid, '_sync_', srrelid, '_', ctl.system_identifier) AS slot_name
743761
FROM pg_control_system() ctl, pg_subscription_rel r, pg_subscription s
744762
WHERE r.srsubstate = 'f' AND s.oid = r.srsubid AND s.subfailover
745-
) UNION (
746-
SELECT s.oid AS subid, s.subslotname as slot_name
747-
FROM pg_subscription s
748-
WHERE s.subfailover
749-
))
750-
WHERE slot_name IS NOT NULL;
763+
);
751764
slots
752765
-------
753-
{sub1,sub2,sub3}
766+
{'pg_16394_sync_16385_7394666715149055164'}
754767
(1 row)
755768
</programlisting></para>
756769
</step>
@@ -761,13 +774,15 @@ test_sub=# SELECT
761774
<programlisting>
762775
test_standby=# SELECT slot_name, (synced AND NOT temporary AND NOT conflicting) AS failover_ready
763776
FROM pg_replication_slots
764-
WHERE slot_name IN ('sub1','sub2','sub3');
765-
slot_name | failover_ready
766-
-------------+----------------
767-
sub1 | t
768-
sub2 | t
769-
sub3 | t
770-
(3 rows)
777+
WHERE slot_name IN
778+
('sub1','sub2','sub3', 'pg_16394_sync_16385_7394666715149055164');
779+
slot_name | failover_ready
780+
--------------------------------------------+----------------
781+
sub1 | t
782+
sub2 | t
783+
sub3 | t
784+
pg_16394_sync_16385_7394666715149055164 | t
785+
(4 rows)
771786
</programlisting></para>
772787
</step>
773788
</procedure>

doc/src/sgml/ref/alter_subscription.sgml

+6-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
7272
<command>ALTER SUBSCRIPTION ... SET (failover = true|false)</command> and
7373
<command>ALTER SUBSCRIPTION ... SET (two_phase = false)</command>
7474
cannot be executed inside a transaction block.
75+
</para>
7576

76-
These commands also cannot be executed when the subscription has
77+
<para>
78+
Commands <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command> and
79+
<command>ALTER SUBSCRIPTION ... {SET|ADD|DROP} PUBLICATION ...</command>
80+
with <literal>refresh</literal> option as <literal>true</literal> also cannot
81+
be executed when the subscription has
7782
<link linkend="sql-createsubscription-params-with-two-phase"><literal>two_phase</literal></link>
7883
commit enabled, unless
7984
<link linkend="sql-createsubscription-params-with-copy-data"><literal>copy_data</literal></link>

0 commit comments

Comments
 (0)