Skip to content

Commit fbf659b

Browse files
committed
Backpatch addition of pump_until() more completely.
In a2ab9c0 I just backpatched the introduction of pump_until(), without changing the existing local definitions (as 6da65a3). The necessary changes seemed more verbose than desirable. However, that leads to warnings, as I failed to realize... Backpatch to all versions containing pump_until() calls before f74496d (there's none in 10). Discussion: https://postgr.es/m/2808491.1651802860@sss.pgh.pa.us Discussion: https://postgr.es/m/18b37361-b482-b9d8-f30d-6115cd5ce25c@enterprisedb.com Backpatch: 11-14
1 parent 2bb9f75 commit fbf659b

File tree

1 file changed

+10
-36
lines changed

1 file changed

+10
-36
lines changed

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

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
INSERT INTO alive VALUES($$committed-before-sigquit$$);
7373
SELECT pg_backend_pid();
7474
];
75-
ok(pump_until($killme, \$killme_stdout, qr/[[:digit:]]+[\r\n]$/m),
75+
ok(pump_until($killme, $psql_timeout, \$killme_stdout, qr/[[:digit:]]+[\r\n]$/m),
7676
'acquired pid for SIGQUIT');
7777
my $pid = $killme_stdout;
7878
chomp($pid);
@@ -84,7 +84,7 @@
8484
BEGIN;
8585
INSERT INTO alive VALUES($$in-progress-before-sigquit$$) RETURNING status;
8686
];
87-
ok(pump_until($killme, \$killme_stdout, qr/in-progress-before-sigquit/m),
87+
ok(pump_until($killme, $psql_timeout, \$killme_stdout, qr/in-progress-before-sigquit/m),
8888
'inserted in-progress-before-sigquit');
8989
$killme_stdout = '';
9090
$killme_stderr = '';
@@ -97,7 +97,7 @@
9797
SELECT $$psql-connected$$;
9898
SELECT pg_sleep(3600);
9999
];
100-
ok(pump_until($monitor, \$monitor_stdout, qr/psql-connected/m),
100+
ok(pump_until($monitor, $psql_timeout, \$monitor_stdout, qr/psql-connected/m),
101101
'monitor connected');
102102
$monitor_stdout = '';
103103
$monitor_stderr = '';
@@ -114,6 +114,7 @@
114114
];
115115
ok( pump_until(
116116
$killme,
117+
$psql_timeout,
117118
\$killme_stderr,
118119
qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly|connection to server was lost/m
119120
),
@@ -127,6 +128,7 @@
127128
# sending.
128129
ok( pump_until(
129130
$monitor,
131+
$psql_timeout,
130132
\$monitor_stderr,
131133
qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly|connection to server was lost/m
132134
),
@@ -149,7 +151,7 @@
149151
$killme_stdin .= q[
150152
SELECT pg_backend_pid();
151153
];
152-
ok(pump_until($killme, \$killme_stdout, qr/[[:digit:]]+[\r\n]$/m),
154+
ok(pump_until($killme, $psql_timeout, \$killme_stdout, qr/[[:digit:]]+[\r\n]$/m),
153155
"acquired pid for SIGKILL");
154156
$pid = $killme_stdout;
155157
chomp($pid);
@@ -162,7 +164,7 @@
162164
BEGIN;
163165
INSERT INTO alive VALUES($$in-progress-before-sigkill$$) RETURNING status;
164166
];
165-
ok(pump_until($killme, \$killme_stdout, qr/in-progress-before-sigkill/m),
167+
ok(pump_until($killme, $psql_timeout, \$killme_stdout, qr/in-progress-before-sigkill/m),
166168
'inserted in-progress-before-sigkill');
167169
$killme_stdout = '';
168170
$killme_stderr = '';
@@ -174,7 +176,7 @@
174176
SELECT $$psql-connected$$;
175177
SELECT pg_sleep(3600);
176178
];
177-
ok(pump_until($monitor, \$monitor_stdout, qr/psql-connected/m),
179+
ok(pump_until($monitor, $psql_timeout, \$monitor_stdout, qr/psql-connected/m),
178180
'monitor connected');
179181
$monitor_stdout = '';
180182
$monitor_stderr = '';
@@ -192,6 +194,7 @@
192194
];
193195
ok( pump_until(
194196
$killme,
197+
$psql_timeout,
195198
\$killme_stderr,
196199
qr/server closed the connection unexpectedly|connection to server was lost/m
197200
),
@@ -203,6 +206,7 @@
203206
# sending.
204207
ok( pump_until(
205208
$monitor,
209+
$psql_timeout,
206210
\$monitor_stderr,
207211
qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly|connection to server was lost/m
208212
),
@@ -240,33 +244,3 @@
240244
'can still write after orderly restart');
241245

242246
$node->stop();
243-
244-
# Pump until string is matched, or timeout occurs
245-
sub pump_until
246-
{
247-
my ($proc, $stream, $untl) = @_;
248-
$proc->pump_nb();
249-
while (1)
250-
{
251-
last if $$stream =~ /$untl/;
252-
if ($psql_timeout->is_expired)
253-
{
254-
diag("aborting wait: program timed out");
255-
diag("stream contents: >>", $$stream, "<<");
256-
diag("pattern searched for: ", $untl);
257-
258-
return 0;
259-
}
260-
if (not $proc->pumpable())
261-
{
262-
diag("aborting wait: program died");
263-
diag("stream contents: >>", $$stream, "<<");
264-
diag("pattern searched for: ", $untl);
265-
266-
return 0;
267-
}
268-
$proc->pump();
269-
}
270-
return 1;
271-
272-
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy