diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-08-12 18:05:49 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-08-12 18:05:49 -0400 |
commit | d11eae09e48694ad6b4139bbb7d7b112833301f5 (patch) | |
tree | 3bf6c74424d1f6172df2f3c9248cb94adf990700 /src | |
parent | 4a2994f055be9405a254b22de6cd2107a0f46563 (diff) | |
download | postgresql-d11eae09e48694ad6b4139bbb7d7b112833301f5.tar.gz postgresql-d11eae09e48694ad6b4139bbb7d7b112833301f5.zip |
Fix bogus loop logic in 013_crash_restart test's pump_until subroutine.
The pump_nb() step might've already received the desired data, so we must
check for that at the top of the loop not the bottom. Otherwise, the
call to pump() will sit with nothing to do until the timeout elapses.
pump_until then falls out with apparent success ... but the timeout has
been used up, causing the next call of pump_until to report a timeout
failure. I believe this explains the intermittent timeout failures
we've seen in the buildfarm ever since this test went in. I was able
to reproduce the problem on gaur semi-repeatably, and this appears to
fix it.
In passing, remove a duplicate assignment, fix one stdin-assignment to
look like the rest, and document the test's dependency on test_decoding.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/recovery/README | 2 | ||||
-rw-r--r-- | src/test/recovery/t/013_crash_restart.pl | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/test/recovery/README b/src/test/recovery/README index a1e1aa1be1c..632e720ebef 100644 --- a/src/test/recovery/README +++ b/src/test/recovery/README @@ -9,6 +9,8 @@ Running the tests ================= NOTE: You must have given the --enable-tap-tests argument to configure. +Also, to use "make installcheck", you must have built and installed +contrib/test_decoding in addition to the core code. Run make check diff --git a/src/test/recovery/t/013_crash_restart.pl b/src/test/recovery/t/013_crash_restart.pl index 440ac097fcf..c928e9201ed 100644 --- a/src/test/recovery/t/013_crash_restart.pl +++ b/src/test/recovery/t/013_crash_restart.pl @@ -157,7 +157,6 @@ ok(pump_until($killme, \$killme_stdout, qr/[[:digit:]]+[\r\n]$/m), "acquired pid for SIGKILL"); $pid = $killme_stdout; chomp($pid); -$pid = $killme_stdout; $killme_stdout = ''; $killme_stderr = ''; @@ -176,7 +175,7 @@ $killme_stderr = ''; # signal that crash-restart has occurred. The initial wait for the # trivial select is to be sure that psql successfully connected to # backend. -$monitor_stdin = q[ +$monitor_stdin .= q[ SELECT $$psql-connected$$; SELECT pg_sleep(3600); ]; @@ -252,6 +251,7 @@ sub pump_until $proc->pump_nb(); while (1) { + last if $$stream =~ /$untl/; if ($psql_timeout->is_expired) { diag("aborting wait: program timed out"); @@ -269,7 +269,6 @@ sub pump_until return 0; } $proc->pump(); - last if $$stream =~ /$untl/; } return 1; |