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>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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-08 13:11:46
Message-ID: CAEYLb_UCWe=yELaeoJ63gG-rdo1Bvd1RM-oe_mbGp0c5Q_cXCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8 July 2011 13:40, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> I put the burden on the callers. Removing the return value from WaitLatch()
> altogether just makes life unnecessarily difficult for callers that could
> safely use that information, even if you sometimes get spurious wakeups. In
> particular, the coding in pgarch.c is nicer if you can simply check the
> return code for WL_TIMEOUT, rather than call time(NULL) to figure out if the
> timeout was reached.

+1

> Attached is a new version of this patch. PostmasterIsAlive() now uses read()
> on the pipe instead of kill().

The consensus so far is that in practice spurious wake-ups in
auxiliary process event loops won't a problem. You may want to wait
for others to weigh in here.

This comment in pgarch.c is slightly malformed - note the quote:

/*
* Sleep until a signal is received, or until a poll is forced by
' PGARCH_AUTOWAKE_INTERVAL having passed since last_copy_time, or
* until postmaster dies.
*/

Other than that, I suggest you commit v8 as-is.

Incidentally, I like that this removes the amDirectChild argument to
PostmasterIsAlive() - an added benefit.

--
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 Heikki Linnakangas 2011-07-08 13:16:28 Re: Latch implementation that wakes on postmaster death on both win32 and Unix
Previous Message Kohei KaiGai 2011-07-08 13:06:30 Re: [v9.2] DROP Reworks Part.1 - Consolidate routines to handle DropStmt