]> granicus.if.org Git - postgresql/commit
Fix a bug with SSI and prepared transactions:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 7 Jul 2011 15:04:37 +0000 (18:04 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 7 Jul 2011 15:13:13 +0000 (18:13 +0300)
commit046d52f7d319419d338fa605f9d6e00b21c5c5ff
treec7c1d0b245a54ac5c358afe543cdc804a9e90dd1
parentcb1cc305bc349338f75a549c36041b4c91cf779f
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
src/backend/storage/lmgr/predicate.c
src/test/regress/expected/prepared_xacts.out
src/test/regress/expected/prepared_xacts_1.out
src/test/regress/sql/prepared_xacts.sql