Re: restarting after power outage

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: lapham(at)jandr(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: restarting after power outage
Date: 2005-04-27 19:03:50
Message-ID: 87wtqoavop.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Jon Lapham <lapham(at)jandr(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-04-27 19:45:34 Re: populating a table via the COPY command using C code.
Previous Message Jon Lapham 2005-04-27 18:55:33 Re: restarting after power outage