From: Kevin Grittner Date: Sun, 5 Dec 2010 20:55:46 +0000 (-0600) Subject: Prevent early rollback of two-transaction write skew. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=refs%2Fheads%2Fidle;p=users%2Fkgrittn%2Fpostgres.git Prevent early rollback of two-transaction write skew. --- diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index 96f6c23a0f..5fec4b60f0 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -2689,7 +2689,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader, offsetof(RWConflictData, outLink)); while (conflict) { - if (reader == conflict->sxactIn + if ((reader == conflict->sxactIn && SxactIsCommitted(reader)) || (SxactIsCommitted(conflict->sxactIn) && !SxactIsCommitted(reader) && (!SxactIsReadOnly(reader) @@ -2783,9 +2783,10 @@ PreCommit_CheckForSerializationFailure(void) offsetof(RWConflictData, inLink)); while (farConflict) { - if (!SxactIsCommitted(farConflict->sxactOut) - && !SxactIsReadOnly(farConflict->sxactOut) - && !SxactIsRolledBack(farConflict->sxactOut)) + if (farConflict->sxactOut == MySerializableXact + || (!SxactIsCommitted(farConflict->sxactOut) + && !SxactIsReadOnly(farConflict->sxactOut) + && !SxactIsRolledBack(farConflict->sxactOut))) { nearConflict->sxactOut->flags |= SXACT_FLAG_INTERRUPT; CancelVirtualTransaction(nearConflict->sxactOut->tag.vxid, 0);