Move RegisterPredicateLockingXid() call to a safer place.
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.
src/backend/access/transam/varsup.c | 5 -----
src/backend/access/transam/xact.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
pgsql-committers by date
|Next:||From: Peter Eisentraut||Date: 2011-05-06 20:07:30|
|Subject: pgsql: Improve compiler string shown in version()|
|Previous:||From: Tom Lane||Date: 2011-05-06 00:39:24|
|Subject: pgsql: Remove precedence labeling of keywords TRUE, FALSE, UNKNOWN,and|