Fix intermittent BF failure in 040_standby_failover_slots_sync. master github/master
authorAmit Kapila <akapila@postgresql.org>
Thu, 18 Dec 2025 05:06:55 +0000 (05:06 +0000)
committerAmit Kapila <akapila@postgresql.org>
Thu, 18 Dec 2025 05:06:55 +0000 (05:06 +0000)
Commit 0d2d4a0ec3 introduced a test that verifies replication slot
synchronization to a standby server via SQL API. However, the test did not
configure synchronized_standby_slots. Without this setting, logical
failover slots can advance beyond the physical replication slot, causing
intermittent synchronization failures.

Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Discussion: https://postgr.es/m/TY4PR01MB16907DF70205308BE918E0D4494ABA@TY4PR01MB16907.jpnprd01.prod.outlook.com

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

index 20f942cfd14581aed775fdf77598d4bb989b801f..7dadd8647e5c51111117277de49e11f94ade45c4 100644 (file)
@@ -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;