Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
19815273
Commit
19815273
authored
23 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Improve LOCK_DEBUG logging code for LWLocks.
parent
ce286ff6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/storage/lmgr/lwlock.c
+17
-2
17 additions, 2 deletions
src/backend/storage/lmgr/lwlock.c
with
17 additions
and
2 deletions
src/backend/storage/lmgr/lwlock.c
+
17
−
2
View file @
19815273
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v 1.
4
2001/12/
10 21:13:50
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v 1.
5
2001/12/
28 23:26:04
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -64,7 +64,7 @@ static LWLockId held_lwlocks[MAX_SIMUL_LWLOCKS];
...
@@ -64,7 +64,7 @@ static LWLockId held_lwlocks[MAX_SIMUL_LWLOCKS];
bool
Trace_lwlocks
=
false
;
bool
Trace_lwlocks
=
false
;
inline
static
void
inline
static
void
PRINT_LWDEBUG
(
const
char
*
where
,
LWLockId
lockid
,
const
LWLock
*
lock
)
PRINT_LWDEBUG
(
const
char
*
where
,
LWLockId
lockid
,
const
volatile
LWLock
*
lock
)
{
{
if
(
Trace_lwlocks
)
if
(
Trace_lwlocks
)
elog
(
DEBUG
,
"%s(%d): excl %d shared %d head %p"
,
elog
(
DEBUG
,
"%s(%d): excl %d shared %d head %p"
,
...
@@ -72,8 +72,17 @@ PRINT_LWDEBUG(const char *where, LWLockId lockid, const LWLock *lock)
...
@@ -72,8 +72,17 @@ PRINT_LWDEBUG(const char *where, LWLockId lockid, const LWLock *lock)
(
int
)
lock
->
exclusive
,
lock
->
shared
,
lock
->
head
);
(
int
)
lock
->
exclusive
,
lock
->
shared
,
lock
->
head
);
}
}
inline
static
void
LOG_LWDEBUG
(
const
char
*
where
,
LWLockId
lockid
,
const
char
*
msg
)
{
if
(
Trace_lwlocks
)
elog
(
DEBUG
,
"%s(%d): %s"
,
where
,
(
int
)
lockid
,
msg
);
}
#else
/* not LOCK_DEBUG */
#else
/* not LOCK_DEBUG */
#define PRINT_LWDEBUG(a,b,c)
#define PRINT_LWDEBUG(a,b,c)
#define LOG_LWDEBUG(a,b,c)
#endif
/* LOCK_DEBUG */
#endif
/* LOCK_DEBUG */
...
@@ -265,6 +274,8 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
...
@@ -265,6 +274,8 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
* received, so that the lock manager or signal manager will see
* received, so that the lock manager or signal manager will see
* the received signal when it next waits.
* the received signal when it next waits.
*/
*/
LOG_LWDEBUG
(
"LWLockAcquire"
,
lockid
,
"waiting"
);
for
(;;)
for
(;;)
{
{
/* "false" means cannot accept cancel/die interrupt here. */
/* "false" means cannot accept cancel/die interrupt here. */
...
@@ -274,6 +285,8 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
...
@@ -274,6 +285,8 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
extraWaits
++
;
extraWaits
++
;
}
}
LOG_LWDEBUG
(
"LWLockAcquire"
,
lockid
,
"awakened"
);
/*
/*
* The awakener already updated the lock struct's state, so we
* The awakener already updated the lock struct's state, so we
* don't need to do anything more to it. Just need to fix the
* don't need to do anything more to it. Just need to fix the
...
@@ -352,6 +365,7 @@ LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode)
...
@@ -352,6 +365,7 @@ LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode)
{
{
/* Failed to get lock, so release interrupt holdoff */
/* Failed to get lock, so release interrupt holdoff */
RESUME_INTERRUPTS
();
RESUME_INTERRUPTS
();
LOG_LWDEBUG
(
"LWLockConditionalAcquire"
,
lockid
,
"failed"
);
}
}
else
else
{
{
...
@@ -448,6 +462,7 @@ LWLockRelease(LWLockId lockid)
...
@@ -448,6 +462,7 @@ LWLockRelease(LWLockId lockid)
*/
*/
while
(
head
!=
NULL
)
while
(
head
!=
NULL
)
{
{
LOG_LWDEBUG
(
"LWLockRelease"
,
lockid
,
"release waiter"
);
proc
=
head
;
proc
=
head
;
head
=
proc
->
lwWaitLink
;
head
=
proc
->
lwWaitLink
;
proc
->
lwWaitLink
=
NULL
;
proc
->
lwWaitLink
=
NULL
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment