Skip to content

Commit ceb18b7

Browse files
Amit Kapilapull[bot]
authored andcommitted
Another try to fix BF failure introduced in commit ddd5f4f.
Before attempting to sync the slot on standby by pg_sync_replication_slots(), ensure that on the primary restart_lsn for the slot has moved to a recent WAL position, by re-creating the subscription and the logical slot. Author: Hou Zhijie Discussion: https://postgr.es/m/CAA4eK1+d5Lne8vCAn0un4SP9x-ZBr2-xfxg01uSfeBTSCKFZoQ@mail.gmail.com
1 parent 1233b13 commit ceb18b7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/test/recovery/t/040_standby_failover_slots_sync.pl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,14 @@
223223
$standby1->append_conf('postgresql.conf', 'max_slot_wal_keep_size = -1');
224224
$standby1->reload;
225225

226-
# Enable the subscription to let it catch up to the latest wal position
227-
$subscriber1->safe_psql('postgres',
228-
"ALTER SUBSCRIPTION regress_mysub1 ENABLE");
226+
# To ensure that restart_lsn has moved to a recent WAL position, we re-create
227+
# the subscription and the logical slot.
228+
$subscriber1->safe_psql(
229+
'postgres', qq[
230+
DROP SUBSCRIPTION regress_mysub1;
231+
CREATE SUBSCRIPTION regress_mysub1 CONNECTION '$publisher_connstr' PUBLICATION regress_mypub WITH (slot_name = lsub1_slot, copy_data = false, failover = true);
232+
]);
229233

230-
# This wait ensures that confirmed_flush_lsn has been moved to latest
231-
# position.
232-
$primary->wait_for_catchup('regress_mysub1');
233-
234-
# To ensure that restart_lsn has moved to a recent WAL position, we need
235-
# to log XLOG_RUNNING_XACTS and make sure the same is processed as well
236-
$primary->psql('postgres', "CHECKPOINT");
237234
$primary->wait_for_catchup('regress_mysub1');
238235

239236
# Do not allow any further advancement of the restart_lsn for the lsub1_slot.

0 commit comments

Comments
 (0)