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_rmgr.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/include/access/twophase_rmgr.h') diff --git a/src/include/access/twophase_rmgr.h b/src/include/access/twophase_rmgr.h index c9ace7ae4da..54d822c708d 100644 --- a/src/include/access/twophase_rmgr.h +++ b/src/include/access/twophase_rmgr.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_rmgr.h,v 1.3 2006/03/05 15:58:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/twophase_rmgr.h,v 1.3.2.1 2009/11/23 09:59:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -26,7 +26,8 @@ typedef uint8 TwoPhaseRmgrId; #define TWOPHASE_RM_INVAL_ID 2 #define TWOPHASE_RM_FLATFILES_ID 3 #define TWOPHASE_RM_NOTIFY_ID 4 -#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_NOTIFY_ID +#define TWOPHASE_RM_MULTIXACT_ID 5 +#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_MULTIXACT_ID extern const TwoPhaseCallback twophase_recover_callbacks[]; extern const TwoPhaseCallback twophase_postcommit_callbacks[]; -- cgit v1.2.3