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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Move RegisterPredicateLockingXid() call to a safer place.
Дата
Msg-id E1QIOLz-00006C-9o@gemulon.postgresql.org
обсуждение исходный текст
Список 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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d2088ae949993ad8e3aabc3b6a9cd77aa5cac957

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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Remove precedence labeling of keywords TRUE, FALSE, UNKNOWN, and
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Improve compiler string shown in version()