aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/multixact.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-12-06 18:10:06 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-12-06 18:10:06 +0000
commita615acf555c0e9ea6ed1c5398d14b81ff2179e6c (patch)
tree553e5845c030e029e955db1830eed3f8f695a09e /src/backend/access/transam/multixact.c
parent953208a34cbb7585ed4ae782141052461d35739b (diff)
downloadpostgresql-a615acf555c0e9ea6ed1c5398d14b81ff2179e6c.tar.gz
postgresql-a615acf555c0e9ea6ed1c5398d14b81ff2179e6c.zip
Arrange for read-only accesses to SLRU page buffers to take only a shared
lock, not exclusive, if the desired page is already in memory. This can be demonstrated to be a significant win on the pg_subtrans cache when there is a large window of open transactions. It should be useful for pg_clog as well. I didn't try to make GetMultiXactIdMembers() use the code, as that would have taken some restructuring, and what with the local cache for multixact contents it probably wouldn't really make a difference. Per my recent proposal.
Diffstat (limited to 'src/backend/access/transam/multixact.c')
-rw-r--r--src/backend/access/transam/multixact.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index 798d9dc61b6..3e8f86818f3 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.13 2005/11/22 18:17:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.14 2005/12/06 18:10:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1690,12 +1690,12 @@ TruncateMultiXact(void)
int entryno;
MultiXactOffset *offptr;
- LWLockAcquire(MultiXactOffsetControlLock, LW_EXCLUSIVE);
+ /* lock is acquired by SimpleLruReadPage_ReadOnly */
pageno = MultiXactIdToOffsetPage(oldestMXact);
entryno = MultiXactIdToOffsetEntry(oldestMXact);
- slotno = SimpleLruReadPage(MultiXactOffsetCtl, pageno, oldestMXact);
+ slotno = SimpleLruReadPage_ReadOnly(MultiXactOffsetCtl, pageno, oldestMXact);
offptr = (MultiXactOffset *) MultiXactOffsetCtl->shared->page_buffer[slotno];
offptr += entryno;
oldestOffset = *offptr;