@@ -725,32 +725,45 @@ ALTER SUBSCRIPTION
725
725
<procedure>
726
726
<step performance="required">
727
727
<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"/>).
734
752
We don't need to ensure that the table sync slots are synced in other scenarios
735
753
as they will either be dropped or re-created on the new primary server in those
736
754
cases.
737
755
<programlisting>
738
756
test_sub=# SELECT
739
- array_agg(slot_name) AS slots
757
+ array_agg(quote_literal( slot_name) ) AS slots
740
758
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
743
761
FROM pg_control_system() ctl, pg_subscription_rel r, pg_subscription s
744
762
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
+ );
751
764
slots
752
765
-------
753
- {sub1,sub2,sub3 }
766
+ {'pg_16394_sync_16385_7394666715149055164' }
754
767
(1 row)
755
768
</programlisting></para>
756
769
</step>
@@ -761,13 +774,15 @@ test_sub=# SELECT
761
774
<programlisting>
762
775
test_standby=# SELECT slot_name, (synced AND NOT temporary AND NOT conflicting) AS failover_ready
763
776
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)
771
786
</programlisting></para>
772
787
</step>
773
788
</procedure>
0 commit comments