Re: Latch implementation that wakes on postmaster death on both win32 and Unix
Peter Geoghegan <peter@2ndquadrant.com>
From: Peter Geoghegan <peter@2ndquadrant.com>
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Cc: Florian Pflug <fgp@phlo.org>, Robert Haas <robertmhaas@gmail.com>, Fujii Masao <masao.fujii@gmail.com>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-07-08T13:11:46Z
Lists: pgsql-hackers
On 8 July 2011 13:40, Heikki Linnakangas <heikki.linnakangas@enterprisedb.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