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

Commit6eec809

Browse files
committed
TAP tests: check for postmaster.pid anyway when "pg_ctl start" fails.
"pg_ctl start" might start a new postmaster and then return failureanyway, for example if PGCTLTIMEOUT is exceeded. If there is apostmaster there, it's still incumbent on us to shut it down atscript end, so check for the PID file even though we are aboutto fail.This has been broken all along, so back-patch to all supported branches.Discussion:https://postgr.es/m/647439.1642622744@sss.pgh.pa.us
1 parent3204b8a commit6eec809

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎src/test/perl/PostgresNode.pm‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,11 @@ sub start
783783
{
784784
print"# pg_ctl start failed; logfile:\n";
785785
print TestLib::slurp_file($self->logfile);
786+
787+
# pg_ctl could have timed out, so check to see if there's a pid file;
788+
# otherwise our END block will fail to shut down the new postmaster.
789+
$self->_update_pid(-1);
790+
786791
BAIL_OUT("pg_ctl start failed")unless$params{fail_ok};
787792
return 0;
788793
}
@@ -1047,7 +1052,10 @@ archive_command = '$copy_command'
10471052
return;
10481053
}
10491054

1050-
# Internal method
1055+
# Internal method to update $self->{_pid}
1056+
# $is_running = 1: pid file should be there
1057+
# $is_running = 0: pid file should NOT be there
1058+
# $is_running = -1: we aren't sure
10511059
sub_update_pid
10521060
{
10531061
my ($self,$is_running) =@_;
@@ -1062,15 +1070,15 @@ sub _update_pid
10621070
close$pidfile;
10631071

10641072
# If we found a pidfile when there shouldn't be one, complain.
1065-
BAIL_OUT("postmaster.pid unexpectedly present")unless$is_running;
1073+
BAIL_OUT("postmaster.pid unexpectedly present")if$is_running == 0;
10661074
return;
10671075
}
10681076

10691077
$self->{_pid} =undef;
10701078
print"# No postmaster PID for node\"$name\"\n";
10711079

10721080
# Complain if we expected to find a pidfile.
1073-
BAIL_OUT("postmaster.pid unexpectedly not present")if$is_running;
1081+
BAIL_OUT("postmaster.pid unexpectedly not present")if$is_running == 1;
10741082
return;
10751083
}
10761084

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp