Re: pg_ctl idempotent option - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: pg_ctl idempotent option
Date
Msg-id 20130129220308.GA31285@momjian.us
Whole thread Raw
In response to Re: pg_ctl idempotent option  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On Tue, Jan 29, 2013 at 04:34:50PM -0500, Peter Eisentraut wrote:
> On 1/28/13 9:29 PM, Bruce Momjian wrote:
> > pg_upgrade uses that to find out of the server was already running or if
> > we started it.  This is to start the server to remove the
> > postmaster.pid file.
> 
> It's currently a bit missed up anyway.  pg_ctl start is successful if
> the server is already started, but pg_ctl -w start fails.

Yeah, that is odd:
# pg_ctl startpg_ctl: another server might be running; trying to start server anywayserver starting# FATAL:  lock file
"postmaster.pid"already existsHINT:  Is another postmaster (PID 14144) running in data directory "/u/pgsql/data"?# echo
$?0#pg_ctl -w startpg_ctl: another server might be running; trying to start server anywaywaiting for server to
start....FATAL: lock file "postmaster.pid" already existsHINT:  Is another postmaster (PID 14144) running in data
directory"/u/pgsql/data"?....pg_ctl: this data directory appears to be running a pre-existing postmaster stopped
waitingpg_ctl:could not start serverExamine the log output.# echo $?1
 

It is because pg_ctl without -w doesn't want to see if the start was
successful.  Fortunately, pg_upgrade always uses -w.

> What pg_upgrade is doing doesn't sound particularly safe, for example
> when something is concurrently starting or stopping the server.

Yes, there is always the risk of someone starting the server while it is
down during pg_upgrade;  we assume the user has control of others
starting the server during pg_upgrade.

> > Also, no one has explained how not knowing if -o
> > options were used was a safe.
> 
> Hmm, good point.  But we already have this problem -- see above.

Yes, also true.  I guess I can only stay it works for -w.  :-(

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_ctl idempotent option
Next
From: Tom Lane
Date:
Subject: Re: enhanced error fields