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

pgsql: Fix a bug with SSI and prepared transactions:

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix a bug with SSI and prepared transactions:
Date: 2011-07-07 15:20:10
Message-ID: E1QeqN8-0005NH-5M@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Fix a bug with SSI and prepared transactions:

If there's a dangerous structure T0 ---> T1 ---> T2, and T2 commits first,
we need to abort something. If T2 commits before both conflicts appear,
then it should be caught by OnConflict_CheckForSerializationFailure. If
both conflicts appear before T2 commits, it should be caught by
PreCommit_CheckForSerializationFailure. But that is actually run when
T2 *prepares*. Fix that in OnConflict_CheckForSerializationFailure, by
treating a prepared T2 as if it committed already.

This is mostly a problem for prepared transactions, which are in prepared
state for some time, but also for regular transactions because they also go
through the prepared state in the SSI code for a short moment when they're
committed.

Kevin Grittner and Dan Ports

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/928408d9e5b4b389897b799b3b6af505d719a3f6

Modified Files
--------------
src/backend/storage/lmgr/predicate.c           |   38 ++++++++++++++++++++++--
src/test/regress/expected/prepared_xacts.out   |    6 ++--
src/test/regress/expected/prepared_xacts_1.out |    2 +-
src/test/regress/sql/prepared_xacts.sql        |    2 +-
4 files changed, 40 insertions(+), 8 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2011-07-07 17:16:00
Subject: pgsql: Finish disabling reduced-lock-levels-for-DDL feature.
Previous:From: Andrew DunstanDate: 2011-07-07 07:54:31
Subject: pgsql: Fix comments over eagerly c&p'd.

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