summaryrefslogtreecommitdiff
path: root/src/include/storage/proc.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-04-14 03:38:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-04-14 03:38:56 +0000
commit0fcc3c2f1d3cc71aa8affe082568b6e033ffa429 (patch)
tree2d2188ea4df90bd0c396dd56f0d28a64c173fbb0 /src/include/storage/proc.h
parentcc39aca7d4a317a66db51a2180f7fee6e76084bd (diff)
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.
Diffstat (limited to 'src/include/storage/proc.h')
-rw-r--r--src/include/storage/proc.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index c6b75f384ee..d7cc4e67320 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.87 2006/03/05 15:59:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.88 2006/04/14 03:38:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ struct PGPROC
SHM_QUEUE links; /* list link if process is in a list */
PGSemaphoreData sem; /* ONE semaphore to sleep on */
- int waitStatus; /* STATUS_OK or STATUS_ERROR after wakeup */
+ int waitStatus; /* STATUS_WAITING, STATUS_OK or STATUS_ERROR */
TransactionId xid; /* transaction currently being executed by
* this proc */
@@ -147,7 +147,6 @@ extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock);
extern bool LockWaitCancel(void);
extern void ProcWaitForSignal(void);
-extern void ProcCancelWaitForSignal(void);
extern void ProcSendSignal(int pid);
extern bool enable_sig_alarm(int delayms, bool is_statement_timeout);