postgres.git / summary / log / commit / refs
commit d225057849e2d4e013f1cd828f04084d004feb8f
Author: Fujii Masao <fujii@postgresql.org>
Date: Thu Aug 27 14:51:21 2026 +0000
Stabilize 019_replslot_limit
The test assumed that advancing WAL would lead to a checkpoint that
invalidates the obsolete replication slot. If a checkpoint that started
before the WAL switch completes first, the following checkpoint can be
skipped as idle, so the expected walsender termination is not logged.
Force a CHECKPOINT in a background psql session after advancing WAL, so
the slot invalidation is exercised deterministically.
This has been observed on buildfarm members alligator and partridge:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=alligator&dt=2024-12-13%2001%3A24%3A58
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=partridge&dt=2026-08-06%2018%3A00%3A11
Backpatch to all supported versions.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/0b07ead5-a5da-445e-9698-a7d340708bdf@gmail.com
Backpatch-through: 14
src/test/recovery/t/019_replslot_limit.pl | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/test/recovery/t/019_replslot_limit.pl b/src/test/recovery/t/019_replslot_limit.pl
index a412faf51c6..aa4217864a1 100644
--- a/src/test/recovery/t/019_replslot_limit.pl
+++ b/src/test/recovery/t/019_replslot_limit.pl
@@ -306,8 +306,6 @@ my $node_primary3 = PostgreSQL::Test::Cluster->new('primary3');
$node_primary3->init(allows_streaming => 1, extra => ['--wal-segsize=1']);
$node_primary3->append_conf(
'postgresql.conf', qq(
- min_wal_size = 2MB
- max_wal_size = 2MB
log_checkpoints = yes
max_slot_wal_keep_size = 1MB
));
@@ -374,6 +372,16 @@ $logstart = -s $node_primary3->logfile;
kill 'STOP', $senderpid, $receiverpid;
$node_primary3->advance_wal(2);
+# Run CHECKPOINT in the background. It is expected to reach slot
+# invalidation, signal the stopped walsender, and then wait until the
+# walsender releases the slot.
+my $checkpoint = $node_primary3->background_psql('postgres');
+$checkpoint->query_until(
+ qr/starting_checkpoint/, q(
+ \echo starting_checkpoint
+ CHECKPOINT;
+));
+
my $msg_logged = 0;
my $max_attempts = $PostgreSQL::Test::Utils::timeout_default;
while ($max_attempts-- >= 0)
@@ -397,6 +405,7 @@ $node_primary3->poll_query_until('postgres',
"SELECT wal_status FROM pg_replication_slots WHERE slot_name = 'rep3'",
"lost")
or die "timed out waiting for slot to be lost";
+$checkpoint->quit;
$msg_logged = 0;
$max_attempts = $PostgreSQL::Test::Utils::timeout_default;
[parent: 4c5291435d40]