Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf452aaf

Browse files
committed
Restore robustness of TAP tests that wait for postmaster restart.
Several TAP tests use poll_query_until() to wait for the postmasterto restart. They were checking to see if a trivial query(e.g. "SELECT 1") succeeds. However, that's problematic in the wakeof commit11e9caf, because now that we feed said query to psqlvia stdin, we risk IPC::Run whining about a SIGPIPE failure if psqlquits before reading the query. Hence, we can't use a nonemptyquery in cases where we need to wait for connection failures tostop happening.Per the precedent of commitsc757a3d and6d41dd0, we can pass"undef" as the query in such cases to ensure that IPC::Run hasnothing to write. However, then we have to say that the expectedoutput is empty, and this exposes a deficiency in poll_query_until:if psql fails altogether and returns empty stdout, poll_query_untilwill treat that as a success! That's because, contrary to itsdocumentation, it makes no actual check for psql failure, lookingneither at the exit status nor at stderr.To fix that, adjust poll_query_until to insist on empty stderr aswell as a stdout match. (I experimented with checking exit statusinstead, but it seems that psql often does exit(1) in cases that weneed to consider successes. That might be something to fix someday,but it would be a non-back-patchable behavior change.)Back-patch to v10. The test cases needing this exist only as farback as v11, but it seems wise to keep poll_query_until's behaviorthe same in v10, in case we back-patch another such test case infuture. (9.6 does not currently need this change, because in thatbranch poll_query_until can't be told to accept empty stdout asa success case.)Per assorted buildfarm failures, mostly on hoverfly.Discussion:https://postgr.es/m/CAA4eK1+zM6L4QSA1XMvXY_qqWwdUmqkOS1+hWvL8QcYEBGA1Uw@mail.gmail.com
1 parent1250aad commitf452aaf

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

‎src/test/perl/PostgresNode.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,8 +2140,10 @@ sub poll_query_until
21402140

21412141
$stdout =~s/\r\n/\n/gif$Config{osname}eq'msys';
21422142
chomp($stdout);
2143+
$stderr =~s/\r\n/\n/gif$Config{osname}eq'msys';
2144+
chomp($stderr);
21432145

2144-
if ($stdouteq$expected)
2146+
if ($stdouteq$expected &&$stderreq'')
21452147
{
21462148
return 1;
21472149
}
@@ -2154,8 +2156,6 @@ sub poll_query_until
21542156

21552157
# The query result didn't change in 180 seconds. Give up. Print the
21562158
# output from the last attempt, hopefully that's useful for debugging.
2157-
$stderr =~s/\r\n/\n/gif$Config{osname}eq'msys';
2158-
chomp($stderr);
21592159
diagqq(poll_query_until timed out executing this query:
21602160
$query
21612161
expecting this output:

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,8 @@
136136
$monitor->finish;
137137

138138
# Wait till server restarts
139-
is($node->poll_query_until(
140-
'postgres',
141-
'SELECT $$restarted after sigquit$$;',
142-
'restarted after sigquit'),
143-
"1",
144-
"reconnected after SIGQUIT");
139+
is($node->poll_query_until('postgres',undef,''),
140+
"1","reconnected after SIGQUIT");
145141

146142

147143
# restart psql processes, now that the crash cycle finished
@@ -216,7 +212,7 @@
216212
$monitor->finish;
217213

218214
# Wait till server restarts
219-
is($node->poll_query_until('postgres','SELECT 1','1'),
215+
is($node->poll_query_until('postgres',undef,''),
220216
"1","reconnected after SIGKILL");
221217

222218
# Make sure the committed rows survived, in-progress ones not

‎src/test/recovery/t/022_crash_temp_files.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ BEGIN
139139
$killme2->finish;
140140

141141
# Wait till server restarts
142-
$node->poll_query_until('postgres','SELECT 1','1');
142+
$node->poll_query_until('postgres',undef,'');
143143

144144
# Check for temporary files
145145
is($node->safe_psql(
@@ -228,7 +228,7 @@ BEGIN
228228
$killme2->finish;
229229

230230
# Wait till server restarts
231-
$node->poll_query_until('postgres','SELECT 1','1');
231+
$node->poll_query_until('postgres',undef,'');
232232

233233
# Check for temporary files -- should be there
234234
is($node->safe_psql(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp