Reimplement ProcArrayLock as a new type of FlexLock. flexlock
authorRobert Haas <rhaas@postgresql.org>
Mon, 14 Nov 2011 15:04:55 +0000 (10:04 -0500)
committerRobert Haas <rhaas@postgresql.org>
Fri, 2 Dec 2011 11:35:30 +0000 (06:35 -0500)
commit0755cb5964c0b33d1894add7bb3a80dbc11a4fb6
treea75523a57795a38b9e7f93036ecb45af82977107
parentf98db4f264ea655f713536db5eed89ebf9531191
Reimplement ProcArrayLock as a new type of 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.
src/backend/commands/analyze.c
src/backend/commands/vacuum.c
src/backend/storage/ipc/procarray.c
src/backend/storage/lmgr/Makefile
src/backend/storage/lmgr/flexlock.c
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/procarraylock.c [new file with mode: 0644]
src/include/storage/flexlock_internals.h
src/include/storage/procarraylock.h [new file with mode: 0644]