aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2021-07-29 17:26:25 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2021-07-29 17:26:25 -0400
commit41d27ee7b870c1a1213704d3c020a01eb55799b0 (patch)
tree845374129cb441b19a961686171f8e90e7680ba1
parentefe169c90090684d2a4ffb0810a0cf2c9b72e19d (diff)
downloadpostgresql-41d27ee7b870c1a1213704d3c020a01eb55799b0.tar.gz
postgresql-41d27ee7b870c1a1213704d3c020a01eb55799b0.zip
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
-rw-r--r--src/test/recovery/t/019_replslot_limit.pl14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/test/recovery/t/019_replslot_limit.pl b/src/test/recovery/t/019_replslot_limit.pl
index fbf4ab432cb..d33ca1e35ad 100644
--- a/src/test/recovery/t/019_replslot_limit.pl
+++ b/src/test/recovery/t/019_replslot_limit.pl
@@ -170,11 +170,21 @@ ok( !find_in_log(
"requested WAL segment [0-9A-F]+ has already been removed"),
'check that required WAL segments are still available');
-# Advance WAL again, the slot loses the oldest segment.
+# Create one checkpoint, to improve stability of the next steps
+$node_master->safe_psql('postgres', "CHECKPOINT;");
+
+# Prevent other checkpoints from occurring while advancing WAL segments
+$node_master->safe_psql('postgres',
+ "ALTER SYSTEM SET max_wal_size='40MB'; SELECT pg_reload_conf()");
+
+# Advance WAL again. The slot loses the oldest segment by the next checkpoint
my $logstart = get_log_size($node_master);
advance_wal($node_master, 7);
-# wait until the WARNING is issued
+# Now create another checkpoint and wait until the WARNING is issued
+$node_master->safe_psql('postgres',
+ 'ALTER SYSTEM RESET max_wal_size; SELECT pg_reload_conf()');
+$node_master->safe_psql('postgres', "CHECKPOINT;");
my $invalidated = 0;
for (my $i = 0; $i < 10000; $i++)
{