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/include/access/twophase.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/include/access/twophase.h') diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h index 14fac1a45ee..d8140f3fcdf 100644 --- a/src/include/access/twophase.h +++ b/src/include/access/twophase.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/twophase.h,v 1.8 2006/07/13 16:49:19 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/twophase.h,v 1.8.2.1 2009/11/23 09:59:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -15,6 +15,7 @@ #define TWOPHASE_H #include "access/xlogdefs.h" +#include "storage/backendid.h" #include "storage/proc.h" #include "utils/timestamp.h" @@ -31,6 +32,7 @@ extern Size TwoPhaseShmemSize(void); extern void TwoPhaseShmemInit(void); extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid); +extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid); extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid, TimestampTz prepared_at, -- cgit v1.2.3