• Tom Lane's avatar
    Move RegisterPredicateLockingXid() call to a safer place. · d2088ae9
    Tom Lane authored
    The SSI patch inserted a call of RegisterPredicateLockingXid into
    GetNewTransactionId, which was a bad idea on a couple of grounds.  First,
    it's not necessary to hold XidGenLock while manipulating that shared
    memory, and doing so is bad because XidGenLock is a high-contention lock
    that should be held for as short a time as possible.  (Not to mention that
    it adds an entirely unnecessary deadlock hazard, since we must take
    SerializableXactHashLock as well.)  Second, the specific place where it was
    put was between extending CLOG and advancing nextXid, which could result in
    unpleasant behavior in case of a failure there.  Pull the call out to
    AssignTransactionId, which is much safer and arguably better from a
    modularity standpoint too.
    
    There is more work to do to clean up the failure-before-advancing-nextXid
    issue, but that is a separate change that will need to be back-patched.
    So for the moment I just want to make GetNewTransactionId look the same as
    it did in prior versions.
    d2088ae9
xact.c 130 KB