Re: How to shoot yourself in the foot: kill -9 postmaster - Mailing list pgsql-hackers

From Tom Lane
Subject Re: How to shoot yourself in the foot: kill -9 postmaster
Date
Msg-id 3632.983845700@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to shoot yourself in the foot: kill -9 postmaster  (Hiroshi Inoue <Inoue@tpf.co.jp>)
List pgsql-hackers
Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> Tom Lane wrote:
>> I think we need a stronger interlock to prevent this scenario, but I'm
>> unsure what it should be.  Ideas?

> Seems the simplest way is to inhibit starting postmaster
> if the pid file exists.

Then we're unable to recover from a crash without manual intervention.

The tricky part of this is not to give up the ability to restart when
there *has* been a crash.

> Another way is to use flock() if flock() is available.
> We could flock() the pid file so that another postmaster
> could detect the lock of the file.

This would only work if every backend is holding flock on the file,
which would mean they'd all have to keep it open all the time.  Kind
of annoying to use up that many file descriptors on it.  Might be the
best answer though; I haven't thought of anything I like better...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Lamar Owen
Date:
Subject: Re: How to shoot yourself in the foot: kill -9 postmaster
Next
From: Lamar Owen
Date:
Subject: Re: How to shoot yourself in the foot: kill -9 postmaster