From 36863892b25adfcedbae0f8d6072a40bcb724fba Mon Sep 17 00:00:00 2001
From: Zhijie Hou <houzj.fnst@fujitsu.com>
Date: Wed, 17 Dec 2025 15:16:38 +0800
Subject: [PATCH v1] Fix an intermittent BF failure

The newly added test in 040_standby_failover_slots_sync synchronizes a
replication slot to the standby server without configuring
synchronized_standby_slots. This omission allows logical failover slots to
advance beyond the designated physical replication slot, resulting in
intermittent synchronization failures.
---
 src/test/recovery/t/040_standby_failover_slots_sync.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

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 20f942cfd14..7dadd8647e5 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -1080,6 +1080,14 @@ $result = $standby2->safe_psql('postgres',
 );
 is($result, 't', "check slot sync skip count increments");
 
+# Configure primary to disallow any logical slots that have enabled failover
+# from getting ahead of the specified physical replication slot (sb2_slot).
+$primary->append_conf(
+	'postgresql.conf', qq(
+synchronized_standby_slots = 'sb2_slot'
+));
+$primary->reload;
+
 # Enable the Subscription, so that the remote slot catches up
 $subscriber1->safe_psql('postgres', "ALTER SUBSCRIPTION regress_mysub1 ENABLE");
 $subscriber1->wait_for_subscription_sync;
-- 
2.51.1.windows.1

