pg_regress not waiting for postmaster to stop

Started by Michael Paquierover 10 years ago4 messages
#1Michael Paquier
michael.paquier@gmail.com
1 attachment(s)

Hi all,

In pg_regress.c, there is the following code:
static void
stop_postmaster(void)
{
if (postmaster_running)
{
/* We use pg_ctl to issue the kill and wait for stop */
char buf[MAXPGPATH * 2];
int r;

/* On Windows, system() seems not to force fflush, so... */
fflush(stdout);
fflush(stderr);

snprintf(buf, sizeof(buf),
"\"%s%spg_ctl\" stop -D \"%s/data\"
-w -s -m fast",
bindir ? bindir : "",
bindir ? "/" : "",
temp_instance);

Except if I am missing something, the comment mentions that we should
wait for the stop but there is no -w switch in the command of pg_ctl.
Doesn't the patch attached make sense?
Regards
--
Michael

Attachments:

20150619_regress_pgctl_stop.patchapplication/x-patch; name=20150619_regress_pgctl_stop.patchDownload
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index a267894..0a05f98 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -265,7 +265,7 @@ stop_postmaster(void)
 		fflush(stderr);
 
 		snprintf(buf, sizeof(buf),
-				 "\"%s%spg_ctl\" stop -D \"%s/data\" -s -m fast",
+				 "\"%s%spg_ctl\" stop -D \"%s/data\" -w -s -m fast",
 				 bindir ? bindir : "",
 				 bindir ? "/" : "",
 				 temp_instance);
#2Robert Haas
robertmhaas@gmail.com
In reply to: Michael Paquier (#1)
Re: pg_regress not waiting for postmaster to stop

On Fri, Jun 19, 2015 at 2:33 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:

In pg_regress.c, there is the following code:
static void
stop_postmaster(void)
{
if (postmaster_running)
{
/* We use pg_ctl to issue the kill and wait for stop */
char buf[MAXPGPATH * 2];
int r;

/* On Windows, system() seems not to force fflush, so... */
fflush(stdout);
fflush(stderr);

snprintf(buf, sizeof(buf),
"\"%s%spg_ctl\" stop -D \"%s/data\"
-w -s -m fast",
bindir ? bindir : "",
bindir ? "/" : "",
temp_instance);

Except if I am missing something, the comment mentions that we should
wait for the stop but there is no -w switch in the command of pg_ctl.
Doesn't the patch attached make sense?

Do we need to wait, or is failing to wait harmless?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#1)
Re: pg_regress not waiting for postmaster to stop

Michael Paquier <michael.paquier@gmail.com> writes:

Except if I am missing something, the comment mentions that we should
wait for the stop but there is no -w switch in the command of pg_ctl.
Doesn't the patch attached make sense?

Per pg_ctl's help output:

(The default is to wait for shutdown, but not for start or restart.)

So -w is already the default in a stop call. Perhaps it would be worth
adding it for documentation's sake, but there's no bug here AFAICS.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Andrew Dunstan
andrew@dunslane.net
In reply to: Michael Paquier (#1)
Re: pg_regress not waiting for postmaster to stop

On 06/19/2015 02:33 AM, Michael Paquier wrote:

Hi all,

In pg_regress.c, there is the following code:
static void
stop_postmaster(void)
{
if (postmaster_running)
{
/* We use pg_ctl to issue the kill and wait for stop */
char buf[MAXPGPATH * 2];
int r;

/* On Windows, system() seems not to force fflush, so... */
fflush(stdout);
fflush(stderr);

snprintf(buf, sizeof(buf),
"\"%s%spg_ctl\" stop -D \"%s/data\"
-w -s -m fast",
bindir ? bindir : "",
bindir ? "/" : "",
temp_instance);

Except if I am missing something, the comment mentions that we should
wait for the stop but there is no -w switch in the command of pg_ctl.
Doesn't the patch attached make sense?

-w is the default for stop.

So the patch shouldn't make any difference.

cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers