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

Commit4492ab5

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 parent19e4694 commit4492ab5

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
@@ -361,7 +361,9 @@ PostgreSQL documentation
361361
<listitem>
362362
<para>
363363
The maximum number of seconds to wait when waiting for startup or
364-
shutdown to complete. The default is 60 seconds.
364+
shutdown to complete. Defaults to the value of the
365+
<envar>PGCTLTIMEOUT</> environment variable or, if not set, to 60
366+
seconds.
365367
</para>
366368
</listitem>
367369
</varlistentry>
@@ -469,6 +471,17 @@ PostgreSQL documentation
469471
<title>Environment</title>
470472

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

‎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 */
@@ -1456,7 +1457,8 @@ pgwin32_CommandLine(bool registration)
14561457
if (registration&&do_wait)
14571458
appendPQExpBuffer(cmdLine," -w");
14581459

1459-
if (registration&&wait_seconds!=DEFAULT_WAIT)
1460+
/* Don't propagate a value from an environment variable. */
1461+
if (registration&&wait_seconds_arg&&wait_seconds!=DEFAULT_WAIT)
14601462
appendPQExpBuffer(cmdLine," -t %d",wait_seconds);
14611463

14621464
if (registration&&silent_mode)
@@ -2291,6 +2293,7 @@ main(int argc, char **argv)
22912293
{NULL,0,NULL,0}
22922294
};
22932295

2296+
char*env_wait;
22942297
intoption_index;
22952298
intc;
22962299
pgpid_tkillproc=0;
@@ -2341,6 +2344,10 @@ main(int argc, char **argv)
23412344
}
23422345
#endif
23432346

2347+
env_wait=getenv("PGCTLTIMEOUT");
2348+
if (env_wait!=NULL)
2349+
wait_seconds=atoi(env_wait);
2350+
23442351
/*
23452352
* 'Action' can be before or after args so loop over both. Some
23462353
* getopt_long() implementations will reorder argv[] to place all flags
@@ -2406,6 +2413,7 @@ main(int argc, char **argv)
24062413
break;
24072414
case't':
24082415
wait_seconds=atoi(optarg);
2416+
wait_seconds_arg= true;
24092417
break;
24102418
case'U':
24112419
if (strchr(optarg,'\\'))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp