Skip site navigation (1) Skip section navigation (2)

Re: pg_ctl idempotent option

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Simon Riggs <simon(at)2ndQuadrant(dot)com>,Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_ctl idempotent option
Date: 2013-01-29 22:03:08
Message-ID: 20130129220308.GA31285@momjian.us (view raw or flat)
Thread:
Lists: 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 start
	pg_ctl: another server might be running; trying to start server anyway
	server starting
	# FATAL:  lock file "postmaster.pid" already exists
	HINT:  Is another postmaster (PID 14144) running in data directory "/u/pgsql/data"?
	# echo $?
	0
	
	# pg_ctl -w start
	pg_ctl: another server might be running; trying to start server anyway
	waiting for server to start....FATAL:  lock file "postmaster.pid" already exists
	HINT:  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 waiting
	pg_ctl: could not start server
	Examine 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(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2013-01-29 22:23:39
Subject: Re: enhanced error fields
Previous:From: Peter EisentrautDate: 2013-01-29 21:34:50
Subject: Re: pg_ctl idempotent option

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group