File tree Expand file tree Collapse file tree 4 files changed +41
-9
lines changed Expand file tree Collapse file tree 4 files changed +41
-9
lines changed Original file line number Diff line number Diff line change 7
7
*
8
8
*
9
9
* 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 $
11
11
*
12
12
* NOTES
13
13
* Outside modules can create a lock table and acquire/release
48
48
#include "access/xact.h"
49
49
#include "access/transam.h"
50
50
51
- static int
52
- WaitOnLock (LOCKTAB * ltable , LockTableId tableId , LOCK * lock ,
51
+ static int WaitOnLock (LOCKTAB * ltable , LockTableId tableId , LOCK * lock ,
53
52
LOCKT lockt );
54
53
55
54
/*#define LOCK_MGR_DEBUG*/
Original file line number Diff line number Diff line change 7
7
*
8
8
*
9
9
* 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 $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
46
46
* This is so that we can support more backends. (system-wide semaphore
47
47
* sets run out pretty fast.) -ay 4/95
48
48
*
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 $
50
50
*/
51
51
#include <sys/time.h>
52
52
#include <unistd.h>
@@ -729,7 +729,8 @@ HandleDeadLock(int sig)
729
729
*/
730
730
UnlockLockTable ();
731
731
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." );
733
734
return ;
734
735
}
735
736
Original file line number Diff line number Diff line change 6
6
*
7
7
* Copyright (c) 1994, Regents of the University of California
8
8
*
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 $
10
10
*
11
11
*-------------------------------------------------------------------------
12
12
*/
@@ -102,8 +102,7 @@ extern bool ProcRemove(int pid);
102
102
/* make static in storage/lmgr/proc.c -- jolly */
103
103
104
104
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 ,
107
106
int prio , LOCK * lock );
108
107
extern int ProcLockWakeup (PROC_QUEUE * queue , char * ltable , char * lock );
109
108
extern void ProcAddLock (SHM_QUEUE * elem );
Original file line number Diff line number Diff line change
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
+ \fB lock \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 \fB select \fP some data, then update it
15
+ inside a transaction. If you don't exclusive lock the table before the
16
+ \fB select \fP , some other user may also read the selected data, and try
17
+ and do their own \fB update \fP , causing a deadlock while you both wait
18
+ for the other to release the \fB select \fP -induced shared lock so you can
19
+ get an exclusive lock to do the \fB update. \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).
You can’t perform that action at this time.
0 commit comments