Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 661bb38

Browse files
committed
Cleanup deadlock message.
1 parent c487962 commit 661bb38

File tree

4 files changed

+41
-9
lines changed

4 files changed

+41
-9
lines changed

src/backend/storage/lmgr/lock.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.18 1998/01/07 21:05:32 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.19 1998/01/23 06:01:03 momjian Exp $
1111
*
1212
* NOTES
1313
* Outside modules can create a lock table and acquire/release
@@ -48,8 +48,7 @@
4848
#include "access/xact.h"
4949
#include "access/transam.h"
5050

51-
static int
52-
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
51+
static int WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
5352
LOCKT lockt);
5453

5554
/*#define LOCK_MGR_DEBUG*/

src/backend/storage/lmgr/proc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.25 1998/01/07 21:05:36 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.26 1998/01/23 06:01:05 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,7 +46,7 @@
4646
* This is so that we can support more backends. (system-wide semaphore
4747
* sets run out pretty fast.) -ay 4/95
4848
*
49-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.25 1998/01/07 21:05:36 momjian Exp $
49+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.26 1998/01/23 06:01:05 momjian Exp $
5050
*/
5151
#include <sys/time.h>
5252
#include <unistd.h>
@@ -729,7 +729,8 @@ HandleDeadLock(int sig)
729729
*/
730730
UnlockLockTable();
731731

732-
elog(NOTICE, "Timeout -- possible deadlock");
732+
elog(NOTICE, "Timeout interval reached -- possible deadlock.");
733+
elog(NOTICE, "See the lock(l) manual page for a possible cause.");
733734
return;
734735
}
735736

src/include/storage/proc.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: proc.h,v 1.8 1997/09/08 21:54:32 momjian Exp $
9+
* $Id: proc.h,v 1.9 1998/01/23 06:01:25 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -102,8 +102,7 @@ extern bool ProcRemove(int pid);
102102
/* make static in storage/lmgr/proc.c -- jolly */
103103

104104
extern void ProcQueueInit(PROC_QUEUE *queue);
105-
extern int
106-
ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token,
105+
extern int ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token,
107106
int prio, LOCK *lock);
108107
extern int ProcLockWakeup(PROC_QUEUE *queue, char *ltable, char *lock);
109108
extern void ProcAddLock(SHM_QUEUE *elem);

src/man/lock.l

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.\" This is -*-nroff-*-
2+
.\" XXX standard disclaimer belongs here....
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/lock.l,v 1.1 1998/01/23 06:01:36 momjian Exp $
4+
.TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL
5+
.SH NAME
6+
lock - exclusive lock a table
7+
.SH SYNOPSIS
8+
.nf
9+
\fBlock\fR classname
10+
.fi
11+
.SH DESCRIPTION
12+
.BR lock
13+
exclusive locks a table inside a transaction. The classic use for this
14+
is the case where you want to \fBselect\fP some data, then update it
15+
inside a transaction. If you don't exclusive lock the table before the
16+
\fBselect\fP, some other user may also read the selected data, and try
17+
and do their own \fBupdate\fP, causing a deadlock while you both wait
18+
for the other to release the \fBselect\fP-induced shared lock so you can
19+
get an exclusive lock to do the \fBupdate.\fP
20+
.SH EXAMPLES
21+
.nf
22+
--
23+
-- Proper locking to prevent deadlock
24+
--
25+
begin work;
26+
lock mytable;
27+
select * from mytable;
28+
update mytable set (x = 100);
29+
end work;
30+
.SH "SEE ALSO"
31+
begin(l),
32+
end(l),
33+
select(l).

0 commit comments

Comments
 (0)