Re: restarting after power outage

From: Philip Hallstrom <postgresql(at)philip(dot)pjkh(dot)com>
To: Doug McNaught <doug(at)mcnaught(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, lapham(at)jandr(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: restarting after power outage
Date: 2005-04-27 19:54:50
Message-ID: 20050427125304.E58007@wolf.pjkh.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>> 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. :)

Or, if your cron supports it, add the following to root's crontab:

@reboot /bin/rm -f /path/to/postgres/pid

Although I like having a separate startup script that runs first to go
around removing this and other things as well...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Frankel 2005-04-27 20:20:37 on insert rule & primary key
Previous Message Peter Wiersig 2005-04-27 19:45:56 Re: restarting after power outage