diff options
| author | Robert Haas | 2011-11-14 15:04:55 +0000 |
|---|---|---|
| committer | Robert Haas | 2011-12-02 11:35:30 +0000 |
| commit | 0755cb5964c0b33d1894add7bb3a80dbc11a4fb6 (patch) | |
| tree | a75523a57795a38b9e7f93036ecb45af82977107 /src/backend/commands/vacuum.c | |
| parent | f98db4f264ea655f713536db5eed89ebf9531191 (diff) | |
Reimplement ProcArrayLock as a new type of FlexLock.flexlock
By providing some custom handling for ProcArrayEndTransaction, we can
avoid the need for ending transactions to repeatedly acquire the
spinlock. The amount of work that needs to be done while holding the
lock is so small that we can do it while holding the spinlock, or
(when the lock is contended) make the last person to release the lock
do it on behalf of the ending backend. This greatly improves
performance for unlogged tables at high client counts; permanent
tables also benefit, but performance is still severely throttled by
WALInsertLock contention.
Diffstat (limited to 'src/backend/commands/vacuum.c')
| -rw-r--r-- | src/backend/commands/vacuum.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index e70dbedbd0..09aa32b95a 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -39,6 +39,7 @@ #include "storage/lmgr.h" #include "storage/proc.h" #include "storage/procarray.h" +#include "storage/procarraylock.h" #include "utils/acl.h" #include "utils/fmgroids.h" #include "utils/guc.h" @@ -895,11 +896,11 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound) * MyProc->xid/xmin, else OldestXmin might appear to go backwards, * which is probably Not Good. */ - LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); + ProcArrayLockAcquire(PAL_EXCLUSIVE); MyPgXact->vacuumFlags |= PROC_IN_VACUUM; if (for_wraparound) MyPgXact->vacuumFlags |= PROC_VACUUM_FOR_WRAPAROUND; - LWLockRelease(ProcArrayLock); + ProcArrayLockRelease(); } /* |
