Skip site navigation (1) Skip section navigation (2)

pgsql: Move RegisterPredicateLockingXid() call to a safer place.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Move RegisterPredicateLockingXid() call to a safer place.
Date: 2011-05-06 16:58:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
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.



Modified Files
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 EisentrautDate: 2011-05-06 20:07:30
Subject: pgsql: Improve compiler string shown in version()
Previous:From: Tom LaneDate: 2011-05-06 00:39:24
Subject: pgsql: Remove precedence labeling of keywords TRUE, FALSE, UNKNOWN,and

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group