Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit661bb38

Browse files
committed
Cleanup deadlock message.
1 parentc487962 commit661bb38

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-
staticint
52-
WaitOnLock(LOCKTAB*ltable,LockTableIdtableId,LOCK*lock,
51+
staticintWaitOnLock(LOCKTAB*ltable,LockTableIdtableId,LOCK*lock,
5352
LOCKTlockt);
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
externvoidProcQueueInit(PROC_QUEUE*queue);
105-
externint
106-
ProcSleep(PROC_QUEUE*queue,SPINLOCKspinlock,inttoken,
105+
externintProcSleep(PROC_QUEUE*queue,SPINLOCKspinlock,inttoken,
107106
intprio,LOCK*lock);
108107
externintProcLockWakeup(PROC_QUEUE*queue,char*ltable,char*lock);
109108
externvoidProcAddLock(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)

[8]ページ先頭

©2009-2025 Movatter.jp