Replace the former method of determining snapshot xmax --- to wit, calling
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Sep 2007 20:31:15 +0000 (20:31 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Sep 2007 20:31:15 +0000 (20:31 +0000)
commit6bd4f401b0cb85f2e81caffc457e415e15e2ed5d
treea0edebb698a1a288be3e66c064c36399cbf5f93f
parent0a51e7073c045b5fce50092dae19f398f7b38e16
Replace the former method of determining snapshot xmax --- to wit, calling
ReadNewTransactionId from GetSnapshotData --- with a "latestCompletedXid"
variable that is updated during transaction commit or abort.  Since
latestCompletedXid is written only in places that had to lock ProcArrayLock
exclusively anyway, and is read only in places that had to lock ProcArrayLock
shared anyway, it adds no new locking requirements to the system despite being
cluster-wide.  Moreover, removing ReadNewTransactionId from snapshot
acquisition eliminates the need to take both XidGenLock and ProcArrayLock at
the same time.  Since XidGenLock is sometimes held across I/O this can be a
significant win.  Some preliminary benchmarking suggested that this patch has
no effect on average throughput but can significantly improve the worst-case
transaction times seen in pgbench.  Concept by Florian Pflug, implementation
by Tom Lane.
14 files changed:
src/backend/access/transam/README
src/backend/access/transam/transam.c
src/backend/access/transam/twophase.c
src/backend/access/transam/varsup.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/catalog/heap.c
src/backend/commands/vacuum.c
src/backend/storage/ipc/procarray.c
src/backend/storage/lmgr/proc.c
src/backend/utils/time/tqual.c
src/include/access/transam.h
src/include/access/xact.h
src/include/storage/procarray.h