Thread: 7.3 pg_ctl anomaly

7.3 pg_ctl anomaly

From
Ed L.
Date:
When I run this command in 7.3,

    pg_ctl -w -o "-p 15432" start

it successfully starts the database, but the -w flag doesn't seem to
notice the successful start and continues to wait until finally
saying "postmaster does not start" and giving up.  Problem is,
postmaster started fine and continues to run fine even after pg_ctl
says it didn't start.  Here's an example session:


$ pg_ctl -w -o "-p 15432" start
waiting for postmaster to start....2002-12-03 11:40:55 [13105]  LOG:
database system was shut down at 2002-12-03 11:40:52 MST
2002-12-03 11:40:55 [13105]  LOG:  checkpoint record is at 0/8019FC
2002-12-03 11:40:55 [13105]  LOG:  redo record is at 0/8019FC; undo
record is at 0/0; shutdown TRUE
2002-12-03 11:40:55 [13105]  LOG:  next transaction id: 489; next
oid: 16976
2002-12-03 11:40:55 [13105]  LOG:  database system is ready
....................2002-12-03 11:41:17 [13169]  LOG:  connection
received: host=127.0.0.1 port=47221
2002-12-03 11:41:17 [13169]  LOG:  connection authorized: user=pg
database=template1
2002-12-03 11:41:17 [13169]  LOG:  query: begin; select
getdatabaseencoding(); commit
2002-12-03 11:41:17 [13169]  LOG:  duration: 0.003379 sec
2002-12-03 11:41:17 [13169]  LOG:  query: select version()
2002-12-03 11:41:17 [13169]  LOG:  duration: 0.001315 sec
....................2002-12-03 11:41:37 [13237]  LOG:  connection
received: host=127.0.0.1 port=47242
2002-12-03 11:41:37 [13237]  LOG:  connection authorized: user=pg
database=template1
2002-12-03 11:41:37 [13237]  LOG:  query: begin; select
getdatabaseencoding(); commit
2002-12-03 11:41:37 [13237]  LOG:  duration: 0.001499 sec
2002-12-03 11:41:37 [13237]  LOG:  query: SeLect version()
2002-12-03 11:41:37 [13237]  LOG:  duration: 0.000777 sec
....................failed
pg_ctl: postmaster does not start


$ uname -a
Linux xxx 2.4.2-2smp #1 SMP Sun Apr 8 20:21:34 EDT 2001 i686 unknown

$ psql -d template1 -c "select version()"
                          version
-----------------------------------------------------------
 PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96


Re: 7.3 pg_ctl anomaly

From
Tom Lane
Date:
"Ed L." <pggeneral@bluepolka.net> writes:
> When I run this command in 7.3,
>     pg_ctl -w -o "-p 15432" start
> it successfully starts the database, but the -w flag doesn't seem to
> notice the successful start and continues to wait until finally
> saying "postmaster does not start" and giving up.

I believe the issue is that pg_ctl doesn't understand that you're
starting the postmaster on a nonstandard port.  Its method of detecting
postmaster startup is to try to log in with psql, so if it's trying
the wrong port this is exactly what will happen.

I have not tried it, but I think it'd work to do this instead:

    export PGPORT=15432
    pg_ctl start

Making your example work as given would mean teaching the pg_ctl
script to parse postmaster options, which seems like way more
trouble than it's worth ...

            regards, tom lane