Re: Latch implementation that wakes on postmaster death on both win32 and Unix - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Latch implementation that wakes on postmaster death on both win32 and Unix
Date
Msg-id CAEYLb_V2h6N0wO7-nizgT7WWdNH28rEZVzfxsf_yrfyqfmQjdg@mail.gmail.com
Whole thread Raw
In response to Re: Latch implementation that wakes on postmaster death on both win32 and Unix  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Latch implementation that wakes on postmaster death on both win32 and Unix
List pgsql-hackers
On 5 July 2011 07:49, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> Good point, and testing shows that that is exactly what happens at least on
> Linux (see attached test program). So, as the code stands, the children will
> go into a busy loop until the grandparent calls waitpid(). That's not good.
>
> In that light, I agree we should replace kill() in PostmasterIsAlive() with
> read() on the pipe. It would react faster than the kill()-based test, which
> seems like a good thing. Or perhaps do both, and return false if either test
> says the postmaster is dead.

Hmm. Why assume that the opposite problem doesn't exist? What if the
kill-based test is faster than the read() on the pipe on some platform
or under some confluence of events?

I suggest that we agree on a standard for determining whether or not
the postmaster is dead and stick to it - that's already the case on
Windows. Since that standard cannot be the kill() based test, because
that would make a postmaster death aware latch implementation
impossible, it has to be the read() test proposed by Florian.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


pgsql-hackers by date:

Previous
From: Jun Ishiduka
Date:
Subject: Re: Online base backup from the hot-standby
Next
From: Fujii Masao
Date:
Subject: Re: Online base backup from the hot-standby