diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2021-07-19 17:21:07 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2021-07-19 17:21:07 -0400 |
commit | ce413eba411633c5c5c9e326d6d0313c9764c711 (patch) | |
tree | 209d4c7d469ab71e057abb50613d921945c22d90 /src | |
parent | bfa2a926daf812bbda2038aec073344693954f16 (diff) | |
download | postgresql-ce413eba411633c5c5c9e326d6d0313c9764c711.tar.gz postgresql-ce413eba411633c5c5c9e326d6d0313c9764c711.zip |
Make new replication slot test code even less racy
Further fix the test code in ead9e51e8236, this time by waiting until
the checkpoint has completed before moving on; this ensures that the
WAL segment removal has already happened when we create the next slot.
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20210719.111318.2042379313472032754.horikyota.ntt@gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/test/recovery/t/019_replslot_limit.pl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/test/recovery/t/019_replslot_limit.pl b/src/test/recovery/t/019_replslot_limit.pl index 921a3c4a427..fbf4ab432cb 100644 --- a/src/test/recovery/t/019_replslot_limit.pl +++ b/src/test/recovery/t/019_replslot_limit.pl @@ -8,7 +8,7 @@ use TestLib; use PostgresNode; use File::Path qw(rmtree); -use Test::More tests => 15; +use Test::More tests => 16; use Time::HiRes qw(usleep); $ENV{PGDATABASE} = 'postgres'; @@ -198,6 +198,19 @@ $result = $node_master->safe_psql( is($result, "rep1|f|t|lost|", 'check that the slot became inactive and the state "lost" persists'); +# Wait until current checkpoint ends +my $checkpoint_ended = 0; +for (my $i = 0; $i < 10000; $i++) +{ + if (find_in_log($node_master, "checkpoint complete: ", $logstart)) + { + $checkpoint_ended = 1; + last; + } + usleep(100_000); +} +ok($checkpoint_ended, 'waited for checkpoint to end'); + # The invalidated slot shouldn't keep the old-segment horizon back; # see bug #17103: https://postgr.es/m/17103-004130e8f27782c9@postgresql.org # Test for this by creating a new slot and comparing its restart LSN |