Skip site navigation (1) Skip section navigation (2)

pgsql: Fix WaitLatch() to return promptly when the requested timeoutex

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix WaitLatch() to return promptly when the requested timeoutex
Date: 2012-11-09 01:05:05
Message-ID: E1TWd1t-0008Rt-Q1@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Fix WaitLatch() to return promptly when the requested timeout expires.

If the sleep is interrupted by a signal, we must recompute the remaining
time to wait; otherwise, a steady stream of non-wait-terminating interrupts
could delay return from WaitLatch indefinitely.  This has been shown to be
a problem for the autovacuum launcher, and there may well be other places
now or in the future with similar issues.  So we'd better make the function
robust, even though this'll add at least one gettimeofday call per wait.

Back-patch to 9.2.  We might eventually need to fix 9.1 as well, but the
code is quite different there, and the usage of WaitLatch in 9.1 is so
limited that it's not clearly important to do so.

Reported and diagnosed by Jeff Janes, though I rewrote his patch rather
heavily.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8354ce92165ee969510e975d30a69f875e3ffcd9

Modified Files
--------------
src/backend/port/unix_latch.c  |  196 ++++++++++++++++++++++++----------------
src/backend/port/win32_latch.c |   37 +++++++--
src/include/storage/latch.h    |   13 ++--
3 files changed, 156 insertions(+), 90 deletions(-)

pgsql-committers by date

Next:From: Peter EisentrautDate: 2012-11-09 05:39:50
Subject: pgsql: XSLT stylesheet: Add slash to directory name
Previous:From: Tom LaneDate: 2012-11-08 21:53:00
Subject: pgsql: Rename ResolveNew() to ReplaceVarsFromTargetList(),and tweak it

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group