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

Commit691073b

Browse files
committed
Honor PGCTLTIMEOUT environment variable for pg_regress' startup wait.
In commit2ffa869 we made pg_ctl recognize an environment variablePGCTLTIMEOUT to set the default timeout for starting and stopping thepostmaster. However, pg_regress uses pg_ctl only for the "stop" end ofthat; it has bespoke code for starting the postmaster, and that code hashistorically had a hard-wired 60-second timeout. Further buildfarmexperience says it'd be a good idea if that timeout were also controlledby PGCTLTIMEOUT, so let's make it so. Like the previous patch, back-patchto all active branches.Discussion: <13969.1461191936@sss.pgh.pa.us>
1 parent6ec1ff8 commit691073b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

‎src/test/regress/pg_regress.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,6 +2389,8 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
23892389
{
23902390
FILE*pg_conf;
23912391
_stringlist*sl;
2392+
constchar*env_wait;
2393+
intwait_seconds;
23922394

23932395
/*
23942396
* Prepare the temp installation
@@ -2562,11 +2564,23 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
25622564
}
25632565

25642566
/*
2565-
* Wait till postmaster is able to accept connections (normally only a
2566-
* second or so, but Cygwin is reportedly *much* slower). Don't wait
2567-
* forever, however.
2567+
* Wait till postmaster is able to accept connections; normally this
2568+
* is only a second or so, but Cygwin is reportedly *much* slower, and
2569+
* test builds using Valgrind or similar tools might be too. Hence,
2570+
* allow the default timeout of 60 seconds to be overridden from the
2571+
* PGCTLTIMEOUT environment variable.
25682572
*/
2569-
for (i=0;i<60;i++)
2573+
env_wait=getenv("PGCTLTIMEOUT");
2574+
if (env_wait!=NULL)
2575+
{
2576+
wait_seconds=atoi(env_wait);
2577+
if (wait_seconds <=0)
2578+
wait_seconds=60;
2579+
}
2580+
else
2581+
wait_seconds=60;
2582+
2583+
for (i=0;i<wait_seconds;i++)
25702584
{
25712585
/* Done if psql succeeds */
25722586
if (system(buf2)==0)
@@ -2587,9 +2601,10 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
25872601

25882602
pg_usleep(1000000L);
25892603
}
2590-
if (i >=60)
2604+
if (i >=wait_seconds)
25912605
{
2592-
fprintf(stderr,_("\n%s: postmaster did not respond within 60 seconds\nExamine %s/log/postmaster.log for the reason\n"),progname,outputdir);
2606+
fprintf(stderr,_("\n%s: postmaster did not respond within %d seconds\nExamine %s/log/postmaster.log for the reason\n"),
2607+
progname,wait_seconds,outputdir);
25932608

25942609
/*
25952610
* If we get here, the postmaster is probably wedged somewhere in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp