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

Commit198242e

Browse files
committed
Accept pg_ctl timeout from the PGCTLTIMEOUT environment variable.
Many automated test suites call pg_ctl. Buildfarm members axolotl,hornet, mandrill, shearwater, sungazer and tern have failed when servershutdown took longer than the pg_ctl default 60s timeout. This additionpermits slow hosts to easily raise the timeout without us editing a--timeout argument into every test suite pg_ctl call. Back-patch to 9.1(all supported versions) for the sake of automated testing.Reviewed by Tom Lane.
1 parent24ce575 commit198242e

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

‎doc/src/sgml/ref/pg_ctl-ref.sgml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@ PostgreSQL documentation
360360
<listitem>
361361
<para>
362362
The maximum number of seconds to wait when waiting for startup or
363-
shutdown to complete. The default is 60 seconds.
363+
shutdown to complete. Defaults to the value of the
364+
<envar>PGCTLTIMEOUT</> environment variable or, if not set, to 60
365+
seconds.
364366
</para>
365367
</listitem>
366368
</varlistentry>
@@ -468,6 +470,17 @@ PostgreSQL documentation
468470
<title>Environment</title>
469471

470472
<variablelist>
473+
<varlistentry>
474+
<term><envar>PGCTLTIMEOUT</envar></term>
475+
476+
<listitem>
477+
<para>
478+
Default limit on the number of seconds to wait when waiting for startup
479+
or shutdown to complete. If not set, the default is 60 seconds.
480+
</para>
481+
</listitem>
482+
</varlistentry>
483+
471484
<varlistentry>
472485
<term><envar>PGDATA</envar></term>
473486

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ typedef enum
7979
staticbooldo_wait= false;
8080
staticboolwait_set= false;
8181
staticintwait_seconds=DEFAULT_WAIT;
82+
staticboolwait_seconds_arg= false;
8283
staticboolsilent_mode= false;
8384
staticShutdownModeshutdown_mode=SMART_MODE;
8485
staticintsig=SIGTERM;/* default */
@@ -1379,7 +1380,8 @@ pgwin32_CommandLine(bool registration)
13791380
if (registration&&do_wait)
13801381
appendPQExpBuffer(cmdLine," -w");
13811382

1382-
if (registration&&wait_seconds!=DEFAULT_WAIT)
1383+
/* Don't propagate a value from an environment variable. */
1384+
if (registration&&wait_seconds_arg&&wait_seconds!=DEFAULT_WAIT)
13831385
appendPQExpBuffer(cmdLine," -t %d",wait_seconds);
13841386

13851387
if (registration&&silent_mode)
@@ -2214,6 +2216,7 @@ main(int argc, char **argv)
22142216
{NULL,0,NULL,0}
22152217
};
22162218

2219+
char*env_wait;
22172220
intoption_index;
22182221
intc;
22192222
pgpid_tkillproc=0;
@@ -2265,6 +2268,10 @@ main(int argc, char **argv)
22652268
}
22662269
#endif
22672270

2271+
env_wait=getenv("PGCTLTIMEOUT");
2272+
if (env_wait!=NULL)
2273+
wait_seconds=atoi(env_wait);
2274+
22682275
/*
22692276
* 'Action' can be before or after args so loop over both. Some
22702277
* getopt_long() implementations will reorder argv[] to place all flags
@@ -2334,6 +2341,7 @@ main(int argc, char **argv)
23342341
break;
23352342
case't':
23362343
wait_seconds=atoi(optarg);
2344+
wait_seconds_arg= true;
23372345
break;
23382346
case'U':
23392347
if (strchr(optarg,'\\'))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp