• Tom Lane's avatar
    Replace the former method of determining snapshot xmax --- to wit, calling · 6bd4f401
    Tom Lane authored
    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.
    6bd4f401
procarray.c 35.3 KB