From 606221989d809df349e636b53e0f5cfba92894b7 Mon Sep 17 00:00:00 2001
From: Hou Zhijie <houzj.fnst@cn.fujitsu.com>
Date: Fri, 16 Feb 2024 15:40:42 +0800
Subject: [PATCH] Disable autovacuum on primary to stabilize the
 040_standby_failover_slots_sync

During slot synchronization, there is a possibility that the slot may not be
immediately synchronized to the standby if the catalog_xmin of the remote slot
lags behind the local catalog_xmin on the standby. In the test, autovacuum can
start before the slots are synchronized, which will update its statistics in
pg_statistic during analyze and assign transaction IDs. As a result, new
transaction IDs are generated on the primary, which then gets replicated to the
standby, leading to the catalog_xmin of the newly synced slot being ahead of
the remote slot. To make the test stable, disable autovacuum on the primary for
this test.
---
 src/test/recovery/t/040_standby_failover_slots_sync.pl | 1 +
 1 file changed, 1 insertion(+)

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 edbfeb3665..8605090b98 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -15,6 +15,7 @@ use Test::More;
 # Create publisher
 my $publisher = PostgreSQL::Test::Cluster->new('publisher');
 $publisher->init(allows_streaming => 'logical');
+$publisher->append_conf('postgresql.conf', 'autovacuum = off');
 $publisher->start;
 
 $publisher->safe_psql('postgres',
-- 
2.30.0.windows.2

