Re: Latch implementation that wakes on postmaster death on both win32 and Unix

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Latch implementation that wakes on postmaster death on both win32 and Unix
Date: 2011-07-05 09:27:52
Message-ID: CAEYLb_V2h6N0wO7-nizgT7WWdNH28rEZVzfxsf_yrfyqfmQjdg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5 July 2011 07:49, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2011-07-05 10:29:05 Re: Online base backup from the hot-standby
Previous Message Jun Ishiduka 2011-07-05 08:41:33 Re: Online base backup from the hot-standby