1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Re-implement deadlock detection and resolution, per design notes posted

to pghackers on 18-Jan-01.
This commit is contained in:
Tom Lane
2001-01-25 03:31:16 +00:00
parent 40203e4f3e
commit a05eae029a
7 changed files with 1017 additions and 574 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: proc.h,v 1.38 2001/01/24 19:43:28 momjian Exp $
* $Id: proc.h,v 1.39 2001/01/25 03:31:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -41,7 +41,7 @@ struct proc
SHM_QUEUE links; /* list link if process is in a list */
SEMA sem; /* ONE semaphore to sleep on */
int errType; /* error code tells why we woke up */
int errType; /* STATUS_OK or STATUS_ERROR after wakeup */
TransactionId xid; /* transaction currently being executed by
* this proc */
@ -86,13 +86,6 @@ do { \
if (MyProc) (MyProc->sLocks[(lock)])--; \
} while (0)
/*
* flags explaining why process woke up
*/
#define NO_ERROR 0
#define ERR_TIMEOUT 1
#define ERR_BUFFER_IO 2
/*
* There is one ProcGlobal struct for the whole installation.
@ -134,10 +127,10 @@ extern void ProcReleaseLocks(bool isCommit);
extern bool ProcRemove(int pid);
extern void ProcQueueInit(PROC_QUEUE *queue);
extern int ProcSleep(LOCKMETHODCTL *lockctl, LOCKMODE lockmode,
extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
LOCK *lock, HOLDER *holder);
extern PROC *ProcWakeup(PROC *proc, int errType);
extern int ProcLockWakeup(LOCKMETHOD lockmethod, LOCK *lock);
extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
extern void ProcReleaseSpins(PROC *proc);
extern bool LockWaitCancel(void);
extern void HandleDeadLock(SIGNAL_ARGS);