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

Commit5940d1b

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 parentfdb11ad commit5940d1b

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
@@ -778,6 +778,11 @@ sub start
778778
{
779779
print"# pg_ctl start failed; logfile:\n";
780780
print TestLib::slurp_file($self->logfile);
781+
782+
# pg_ctl could have timed out, so check to see if there's a pid file;
783+
# otherwise our END block will fail to shut down the new postmaster.
784+
$self->_update_pid(-1);
785+
781786
BAIL_OUT("pg_ctl start failed")unless$params{fail_ok};
782787
return 0;
783788
}
@@ -1019,7 +1024,10 @@ archive_command = '$copy_command'
10191024
return;
10201025
}
10211026

1022-
# Internal method
1027+
# Internal method to update $self->{_pid}
1028+
# $is_running = 1: pid file should be there
1029+
# $is_running = 0: pid file should NOT be there
1030+
# $is_running = -1: we aren't sure
10231031
sub_update_pid
10241032
{
10251033
my ($self,$is_running) =@_;
@@ -1034,15 +1042,15 @@ sub _update_pid
10341042
close$pidfile;
10351043

10361044
# If we found a pidfile when there shouldn't be one, complain.
1037-
BAIL_OUT("postmaster.pid unexpectedly present")unless$is_running;
1045+
BAIL_OUT("postmaster.pid unexpectedly present")if$is_running == 0;
10381046
return;
10391047
}
10401048

10411049
$self->{_pid} =undef;
10421050
print"# No postmaster PID for node\"$name\"\n";
10431051

10441052
# Complain if we expected to find a pidfile.
1045-
BAIL_OUT("postmaster.pid unexpectedly not present")if$is_running;
1053+
BAIL_OUT("postmaster.pid unexpectedly not present")if$is_running == 1;
10461054
return;
10471055
}
10481056

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp