Skip to content

Commit 41d27ee

Browse files
committed
Close yet another race condition in replication slot test code
Buildfarm shows that this test has a further failure mode when a checkpoint starts earlier than expected, so we detect a "checkpoint completed" line that's not the one we want. Change the config to try and prevent this. Per buildfarm Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/20210729.162038.534808353849568395.horikyota.ntt@gmail.com
1 parent efe169c commit 41d27ee

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/test/recovery/t/019_replslot_limit.pl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,21 @@
170170
"requested WAL segment [0-9A-F]+ has already been removed"),
171171
'check that required WAL segments are still available');
172172

173-
# Advance WAL again, the slot loses the oldest segment.
173+
# Create one checkpoint, to improve stability of the next steps
174+
$node_master->safe_psql('postgres', "CHECKPOINT;");
175+
176+
# Prevent other checkpoints from occurring while advancing WAL segments
177+
$node_master->safe_psql('postgres',
178+
"ALTER SYSTEM SET max_wal_size='40MB'; SELECT pg_reload_conf()");
179+
180+
# Advance WAL again. The slot loses the oldest segment by the next checkpoint
174181
my $logstart = get_log_size($node_master);
175182
advance_wal($node_master, 7);
176183

177-
# wait until the WARNING is issued
184+
# Now create another checkpoint and wait until the WARNING is issued
185+
$node_master->safe_psql('postgres',
186+
'ALTER SYSTEM RESET max_wal_size; SELECT pg_reload_conf()');
187+
$node_master->safe_psql('postgres', "CHECKPOINT;");
178188
my $invalidated = 0;
179189
for (my $i = 0; $i < 10000; $i++)
180190
{

0 commit comments

Comments
 (0)