Fwd: Bug#358546: failure of pg_ctl start -w -D
От | Martin Pitt |
---|---|
Тема | Fwd: Bug#358546: failure of pg_ctl start -w -D |
Дата | |
Msg-id | 20060326124943.GF6080@piware.de обсуждение исходный текст |
Ответы |
Re: Fwd: Bug#358546: failure of pg_ctl start -w -D
(Tom Lane <tgl@sss.pgh.pa.us>)
|
Список | pgsql-bugs |
Hi PostgreSQL developers, the bug report below was recently sent to Debian. The details and my reply are at http://bugs.debian.org/358546, the executive summary is: pg_ctl's -w option does not honour postgresql.conf's unix_socket_directory configuration (and neither $PGHOST). Thanks, Martin=20 ----- Forwarded message from Stephen Gildea <gildea@stop.mail-abuse.org> --= --- Subject: Bug#358546: failure of pg_ctl start -w -D Reply-To: Stephen Gildea <gildea@stop.mail-abuse.org>, 358546@bugs.debian.org From: Stephen Gildea <gildea@stop.mail-abuse.org> To: submit@bugs.debian.org Date: Wed, 22 Mar 2006 22:39:27 -0500 X-Spam-Status: No, score=3D1.3 required=3D4.0 tests=3DBAYES_50,DATE_IN_FUTU= RE_06_12=20 autolearn=3Dno version=3D3.0.3 Package: postgresql-7.4 Version: 7.4.12-2 Tags: patch When starting the PostgreSQL server (with "pg_ctl start") with a specific directory (the -D flag), the "wait" code (triggered with the -w option) fails to use the directory to find the Unix socket, and so it fails to connect to the newly-started server. To repeat, create a new database and start a server on it: /usr/lib/postgresql/bin/initdb -D /some/directory Edit /some/directory/postgresql.conf to define unix_socket_directory. (It may be a separate bug that this step is necessary.) /usr/lib/postgresql/bin/pg_ctl start -w -D /some/directory -l /some/directo= ry/postgres.log Note the "failed" error message, even though the server did start. The following simple patch passes the Unix socket directory to psql for the wait check. In PostgreSQL 8, the pg_ctl shell script has been replaced by a C program. I haven't tested it, but from looking at the code in pg_ctl.c, I suspect the same bug is present. Running "start -w" calls test_postmaster_connection(). As with the buggy script, that routine sets only the port and fails to set the host/directory as well. < Stephen --- postgresql-7.4.12/src/bin/pg_ctl/pg_ctl.sh 2004-10-21 20:24:27.00000000= 0 -0400 +++ src/bin/pg_ctl/pg_ctl.sh 2006-03-20 13:31:23.000000000 -0500 @@ -387,20 +387,23 @@ if [ -z "$PGPORT" ];then PGPORT=3D`sed -ne 's/^[ ]*port[^=3D]*=3D[ ]\+\([0-9]\+\).*/\1/p'= $CONFFILE 2>/dev/null` if [ -z "$PGPORT" ];then PGPORT=3D"$DEF_PGPORT" fi fi + if [ -z "$PGHOST" ];then + PGHOST=3D`sed -ne "s/^[ ]*unix_socket_directory[^=3D]*=3D[ ]\+'\= ([^'].*\)'/\1/p" "$CONFFILE" 2>/dev/null` + fi =20 # wait for postmaster to start if [ "$wait" =3D yes ];then cnt=3D0 $silence_echo $ECHO_N "waiting for postmaster to start..."$ECHO_C while : do - if "$PGPATH/psql" -p $PGPORT -l >/dev/null 2>&1 + if "$PGPATH/psql" -p $PGPORT -h "$PGHOST" -l >/dev/null 2>&1 then break; else $silence_echo $ECHO_N "."$ECHO_C cnt=3D`expr $cnt + 1` if [ "$cnt" -gt "$wait_seconds" ];then ----- End forwarded message ----- --=20 Martin Pitt http://www.piware.de Ubuntu Developer http://www.ubuntu.com Debian Developer http://www.debian.org In a world without walls and fences, who needs Windows and Gates?
В списке pgsql-bugs по дате отправления:
Следующее
От: Martin PittДата:
Сообщение: Followup comment for bug report 'postmaster ignores SIGPIPE' [was: Bug#255208: Would help with client aborts, too.]