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
82b36846
Commit
82b36846
authored
17 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Add comments spelling out why it's a good idea to release multiple
partition locks in reverse order.
parent
e9e97500
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backend/storage/lmgr/lock.c
+8
-2
8 additions, 2 deletions
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/proc.c
+6
-4
6 additions, 4 deletions
src/backend/storage/lmgr/proc.c
with
14 additions
and
6 deletions
src/backend/storage/lmgr/lock.c
+
8
−
2
View file @
82b36846
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.17
6
2007/0
2/01 19:10:28 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.17
7
2007/0
7/16 21:09:50 tgl
Exp $
*
*
* NOTES
* NOTES
* A lock table is a shared memory hash table. When
* A lock table is a shared memory hash table. When
...
@@ -2119,7 +2119,13 @@ GetLockStatusData(void)
...
@@ -2119,7 +2119,13 @@ GetLockStatusData(void)
el
++
;
el
++
;
}
}
/* And release locks */
/*
* And release locks. We do this in reverse order for two reasons:
* (1) Anyone else who needs more than one of the locks will be trying
* to lock them in increasing order; we don't want to release the other
* process until it can get all the locks it needs.
* (2) This avoids O(N^2) behavior inside LWLockRelease.
*/
for
(
i
=
NUM_LOCK_PARTITIONS
;
--
i
>=
0
;)
for
(
i
=
NUM_LOCK_PARTITIONS
;
--
i
>=
0
;)
LWLockRelease
(
FirstLockMgrLock
+
i
);
LWLockRelease
(
FirstLockMgrLock
+
i
);
...
...
This diff is collapsed.
Click to expand it.
src/backend/storage/lmgr/proc.c
+
6
−
4
View file @
82b36846
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.19
0
2007/0
6
/1
9
2
2
:0
1:15
tgl Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.19
1
2007/0
7
/1
6
2
1
:0
9:50
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1168,9 +1168,11 @@ CheckDeadLock(void)
...
@@ -1168,9 +1168,11 @@ CheckDeadLock(void)
}
}
/*
/*
* Release locks acquired at head of routine. Order is not critical, so
* And release locks. We do this in reverse order for two reasons:
* do it back-to-front to avoid waking another CheckDeadLock instance
* (1) Anyone else who needs more than one of the locks will be trying
* before it can get all the locks.
* to lock them in increasing order; we don't want to release the other
* process until it can get all the locks it needs.
* (2) This avoids O(N^2) behavior inside LWLockRelease.
*/
*/
check_done:
check_done:
for
(
i
=
NUM_LOCK_PARTITIONS
;
--
i
>=
0
;)
for
(
i
=
NUM_LOCK_PARTITIONS
;
--
i
>=
0
;)
...
...
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