From 0fcc3c2f1d3cc71aa8affe082568b6e033ffa429 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 14 Apr 2006 03:38:56 +0000 Subject: Repair a low-probability race condition identified by Qingqing Zhou. If a process abandons a wait in LockBufferForCleanup (in practice, only happens if someone cancels a VACUUM) just before someone else sends it a signal indicating the buffer is available, it was possible for the wakeup to remain in the process' semaphore, causing misbehavior next time the process waited for an lmgr lock. Rather than try to prevent the race condition directly, it seems best to make the lock manager robust against leftover wakeups, by having it repeat waiting on the semaphore if the lock has not actually been granted or denied yet. --- src/include/c.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/include/c.h') diff --git a/src/include/c.h b/src/include/c.h index 849a0ee660..32082809ec 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.199 2006/03/05 15:58:52 momjian Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.200 2006/04/14 03:38:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -710,6 +710,7 @@ typedef NameData *Name; #define STATUS_ERROR (-1) #define STATUS_EOF (-2) #define STATUS_FOUND (1) +#define STATUS_WAITING (2) /* ---------------------------------------------------------------- -- cgit v1.2.1