Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
661bb388
Commit
661bb388
authored
Jan 23, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup deadlock message.
parent
c487962d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
9 deletions
+41
-9
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lock.c
+2
-3
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+4
-3
src/include/storage/proc.h
src/include/storage/proc.h
+2
-3
src/man/lock.l
src/man/lock.l
+33
-0
No files found.
src/backend/storage/lmgr/lock.c
View file @
661bb388
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.1
8 1998/01/07 21:05:32
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.1
9 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*/
...
...
src/backend/storage/lmgr/proc.c
View file @
661bb388
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.2
5 1998/01/07 21:05:36
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.2
6 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.2
5 1998/01/07 21:05:36
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.2
6 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
;
}
...
...
src/include/storage/proc.h
View file @
661bb388
...
...
@@ -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
);
...
...
src/man/lock.l
0 → 100644
View file @
661bb388
.\" 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).
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment