Cleanup deadlock message.

This commit is contained in:
Bruce Momjian 1998-01-23 06:01:36 +00:00
parent c487962dd7
commit 661bb38812
4 changed files with 41 additions and 9 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.18 1998/01/07 21:05:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.19 1998/01/23 06:01:03 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
@ -48,8 +48,7 @@
#include "access/xact.h"
#include "access/transam.h"
static int
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
static int WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
LOCKT lockt);
/*#define LOCK_MGR_DEBUG*/

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.25 1998/01/07 21:05:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.26 1998/01/23 06:01:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.25 1998/01/07 21:05:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.26 1998/01/23 06:01:05 momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
@ -729,7 +729,8 @@ HandleDeadLock(int sig)
*/
UnlockLockTable();
elog(NOTICE, "Timeout -- possible deadlock");
elog(NOTICE, "Timeout interval reached -- possible deadlock.");
elog(NOTICE, "See the lock(l) manual page for a possible cause.");
return;
}

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: proc.h,v 1.8 1997/09/08 21:54:32 momjian Exp $
* $Id: proc.h,v 1.9 1998/01/23 06:01:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -102,8 +102,7 @@ extern bool ProcRemove(int pid);
/* make static in storage/lmgr/proc.c -- jolly */
extern void ProcQueueInit(PROC_QUEUE *queue);
extern int
ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token,
extern int ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token,
int prio, LOCK *lock);
extern int ProcLockWakeup(PROC_QUEUE *queue, char *ltable, char *lock);
extern void ProcAddLock(SHM_QUEUE *elem);

33
src/man/lock.l Normal file
View File

@ -0,0 +1,33 @@
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/lock.l,v 1.1 1998/01/23 06:01:36 momjian Exp $
.TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL
.SH NAME
lock - exclusive lock a table
.SH SYNOPSIS
.nf
\fBlock\fR classname
.fi
.SH DESCRIPTION
.BR lock
exclusive locks a table inside a transaction. The classic use for this
is the case where you want to \fBselect\fP some data, then update it
inside a transaction. If you don't exclusive lock the table before the
\fBselect\fP, some other user may also read the selected data, and try
and do their own \fBupdate\fP, causing a deadlock while you both wait
for the other to release the \fBselect\fP-induced shared lock so you can
get an exclusive lock to do the \fBupdate.\fP
.SH EXAMPLES
.nf
--
-- Proper locking to prevent deadlock
--
begin work;
lock mytable;
select * from mytable;
update mytable set (x = 100);
end work;
.SH "SEE ALSO"
begin(l),
end(l),
select(l).