diff options
author | Noah Misch <noah@leadboat.com> | 2020-11-28 21:52:27 -0800 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2020-11-28 21:52:31 -0800 |
commit | 7b5b90be95663f3feb1f7c141b07485d593268cf (patch) | |
tree | 7e963b96f1e773ae33ed772df82c1beba090884d | |
parent | cbc7a7a10c2d91cfa0401e9f68b17f19b7d5e7d2 (diff) |
Retry initial slurp_file("current_logfiles"), in test 004_logrotate.pl.
Buildfarm member topminnow failed when the test script attempted this
before the syslogger would have created the file. Back-patch to v12,
which introduced the test.
-rw-r--r-- | src/bin/pg_ctl/t/004_logrotate.pl | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/bin/pg_ctl/t/004_logrotate.pl b/src/bin/pg_ctl/t/004_logrotate.pl index acaade8d812..bc39abd23e4 100644 --- a/src/bin/pg_ctl/t/004_logrotate.pl +++ b/src/bin/pg_ctl/t/004_logrotate.pl @@ -21,7 +21,19 @@ $node->start(); $node->psql('postgres', 'SELECT 1/0'); -my $current_logfiles = slurp_file($node->data_dir . '/current_logfiles'); +# might need to retry if logging collector process is slow... +my $max_attempts = 180 * 10; + +my $current_logfiles; +for (my $attempts = 0; $attempts < $max_attempts; $attempts++) +{ + eval { + $current_logfiles = slurp_file($node->data_dir . '/current_logfiles'); + }; + last unless $@; + usleep(100_000); +} +die $@ if $@; note "current_logfiles = $current_logfiles"; @@ -34,9 +46,6 @@ my $lfname = $current_logfiles; $lfname =~ s/^stderr //; chomp $lfname; -# might need to retry if logging collector process is slow... -my $max_attempts = 180 * 10; - my $first_logfile; for (my $attempts = 0; $attempts < $max_attempts; $attempts++) { |