aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2024-02-15 10:37:28 +0530
committerAmit Kapila <akapila@postgresql.org>2024-02-15 10:37:28 +0530
commit9bc1eee988c31e66a27e007d41020664df490214 (patch)
treefae15c12a3e439282626e531c3cdec66208738c7
parent0c444a70f2a79d4d7ef6f1af057909839e5b2097 (diff)
downloadpostgresql-9bc1eee988c31e66a27e007d41020664df490214.tar.gz
postgresql-9bc1eee988c31e66a27e007d41020664df490214.zip
Another try to fix BF failure introduced in commit ddd5f4f54a.
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
-rw-r--r--src/test/recovery/t/040_standby_failover_slots_sync.pl17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl
index 9634a50b3ec..7ad5f2eb11a 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -223,17 +223,14 @@ is( $standby1->safe_psql(
$standby1->append_conf('postgresql.conf', 'max_slot_wal_keep_size = -1');
$standby1->reload;
-# Enable the subscription to let it catch up to the latest wal position
-$subscriber1->safe_psql('postgres',
- "ALTER SUBSCRIPTION regress_mysub1 ENABLE");
+# To ensure that restart_lsn has moved to a recent WAL position, we re-create
+# the subscription and the logical slot.
+$subscriber1->safe_psql(
+ 'postgres', qq[
+ DROP SUBSCRIPTION regress_mysub1;
+ CREATE SUBSCRIPTION regress_mysub1 CONNECTION '$publisher_connstr' PUBLICATION regress_mypub WITH (slot_name = lsub1_slot, copy_data = false, failover = true);
+]);
-# This wait ensures that confirmed_flush_lsn has been moved to latest
-# position.
-$primary->wait_for_catchup('regress_mysub1');
-
-# To ensure that restart_lsn has moved to a recent WAL position, we need
-# to log XLOG_RUNNING_XACTS and make sure the same is processed as well
-$primary->psql('postgres', "CHECKPOINT");
$primary->wait_for_catchup('regress_mysub1');
# Do not allow any further advancement of the restart_lsn for the lsub1_slot.