Re: restarting after power outage - Mailing list pgsql-general

From Doug McNaught
Subject Re: restarting after power outage
Date
Msg-id 87wtqoavop.fsf@asmodeus.mcnaught.org
Whole thread Raw
In response to Re: restarting after power outage  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: restarting after power outage  (Peter Wiersig <peter@friesenpeter.de>)
Re: restarting after power outage  (Philip Hallstrom <postgresql@philip.pjkh.com>)
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Jon Lapham <lapham@jandr.org> writes:
>> Tom Lane wrote:
>>> It is.  We have been fooling with the postmaster startup logic to try to
>>> eliminate this gotcha, but it's only very recently (8.0.2) that I think
>>> we got it right.
>
>> So, then it would be correct to change my init scripts to do the
>> following:  (if so, this patch can be applied to the 7.4 branch)
>
> I would recommend strongly AGAINST that, because what you just did was
> remove the defense against starting two postmasters concurrently in the
> same data directory (which would be a disaster of the first magnitude).
> This is not a problem for bootup of course, but if you ever use this
> script to start the postmaster by hand, then you are playing with fire.

What I have done is to create a separate init.d script that removes
the PID file, and arrange for it to run before the PG startup script.
That way you can use the regular script to stop and start without
danger, but on a bootup after an unclean shutdown the PID file will
get removed before PG gets started.  If you're dumb enough to run the
removal script by hand while PG is running, you deserve what you get.  :)

-Doug

pgsql-general by date:

Previous
From: Jon Lapham
Date:
Subject: Re: restarting after power outage
Next
From: Peter Wiersig
Date:
Subject: Re: restarting after power outage