From 26a13b72421f6d54077db23200326536ece2cf7c Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 23 Nov 2009 09:59:11 +0000 Subject: Fix an old bug in multixact and two-phase commit. Prepared transactions can be part of multixacts, so allocate a slot for each prepared transaction in the "oldest member" array in multixact.c. On PREPARE TRANSACTION, transfer the oldest member value from the current backends slot to the prepared xact slot. Also save and recover the value from the 2pc state file. The symptom of the bug was that after a transaction prepared, a shared lock still held by the prepared transaction was sometimes ignored by other transactions. Fix back to 8.1, where both 2PC and multixact were introduced. --- src/backend/access/transam/xact.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/backend/access/transam/xact.c') diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 6ef1f5a7420..5b94cda2037 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.229.2.4 2008/03/04 19:54:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.229.2.5 2009/11/23 09:59:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -1787,6 +1787,7 @@ PrepareTransaction(void) AtPrepare_UpdateFlatFiles(); AtPrepare_Inval(); AtPrepare_Locks(); + AtPrepare_MultiXact(); /* * Here is where we really truly prepare. @@ -1848,7 +1849,7 @@ PrepareTransaction(void) PostPrepare_smgr(); - AtEOXact_MultiXact(); + PostPrepare_MultiXact(xid); PostPrepare_Locks(xid); -- cgit v1.2.3