Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d11eae0

Browse files
committed
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.
1 parent 4a2994f commit d11eae0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/test/recovery/README

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Running the tests
99
=================
1010

1111
NOTE: You must have given the --enable-tap-tests argument to configure.
12+
Also, to use "make installcheck", you must have built and installed
13+
contrib/test_decoding in addition to the core code.
1214

1315
Run
1416
make check

src/test/recovery/t/013_crash_restart.pl

+2-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
"acquired pid for SIGKILL");
158158
$pid = $killme_stdout;
159159
chomp($pid);
160-
$pid = $killme_stdout;
161160
$killme_stdout = '';
162161
$killme_stderr = '';
163162

@@ -176,7 +175,7 @@
176175
# signal that crash-restart has occurred. The initial wait for the
177176
# trivial select is to be sure that psql successfully connected to
178177
# backend.
179-
$monitor_stdin = q[
178+
$monitor_stdin .= q[
180179
SELECT $$psql-connected$$;
181180
SELECT pg_sleep(3600);
182181
];
@@ -252,6 +251,7 @@ sub pump_until
252251
$proc->pump_nb();
253252
while (1)
254253
{
254+
last if $$stream =~ /$untl/;
255255
if ($psql_timeout->is_expired)
256256
{
257257
diag("aborting wait: program timed out");
@@ -269,7 +269,6 @@ sub pump_until
269269
return 0;
270270
}
271271
$proc->pump();
272-
last if $$stream =~ /$untl/;
273272
}
274273
return 1;
275274

0 commit comments

Comments
 (0)