diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/subtrans.h | 4 | ||||
-rw-r--r-- | src/include/access/twophase.h | 49 | ||||
-rw-r--r-- | src/include/access/twophase_rmgr.h | 39 | ||||
-rw-r--r-- | src/include/access/xact.h | 38 | ||||
-rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
-rw-r--r-- | src/include/catalog/pg_proc.h | 4 | ||||
-rw-r--r-- | src/include/commands/async.h | 6 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 8 | ||||
-rw-r--r-- | src/include/storage/ipc.h | 6 | ||||
-rw-r--r-- | src/include/storage/lmgr.h | 4 | ||||
-rw-r--r-- | src/include/storage/lock.h | 17 | ||||
-rw-r--r-- | src/include/storage/lwlock.h | 3 | ||||
-rw-r--r-- | src/include/storage/proc.h | 25 | ||||
-rw-r--r-- | src/include/storage/procarray.h | 18 | ||||
-rw-r--r-- | src/include/storage/smgr.h | 3 | ||||
-rw-r--r-- | src/include/utils/builtins.h | 5 | ||||
-rw-r--r-- | src/include/utils/flatfiles.h | 6 | ||||
-rw-r--r-- | src/include/utils/inval.h | 9 | ||||
-rw-r--r-- | src/include/utils/portal.h | 3 |
19 files changed, 203 insertions, 48 deletions
diff --git a/src/include/access/subtrans.h b/src/include/access/subtrans.h index ac884775a09..2810e438d54 100644 --- a/src/include/access/subtrans.h +++ b/src/include/access/subtrans.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/subtrans.h,v 1.5 2004/12/31 22:03:21 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/access/subtrans.h,v 1.6 2005/06/17 22:32:48 tgl Exp $ */ #ifndef SUBTRANS_H #define SUBTRANS_H @@ -18,7 +18,7 @@ extern TransactionId SubTransGetTopmostTransaction(TransactionId xid); extern int SUBTRANSShmemSize(void); extern void SUBTRANSShmemInit(void); extern void BootStrapSUBTRANS(void); -extern void StartupSUBTRANS(void); +extern void StartupSUBTRANS(TransactionId oldestActiveXID); extern void ShutdownSUBTRANS(void); extern void CheckPointSUBTRANS(void); extern void ExtendSUBTRANS(TransactionId newestXact); diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h new file mode 100644 index 00000000000..ac2e05f33ce --- /dev/null +++ b/src/include/access/twophase.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * twophase.h + * Two-phase-commit related declarations. + * + * + * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $PostgreSQL: pgsql/src/include/access/twophase.h,v 1.1 2005/06/17 22:32:48 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef TWOPHASE_H +#define TWOPHASE_H + +#include "storage/lock.h" + + +/* + * GlobalTransactionData is defined in twophase.c; other places have no + * business knowing the internal definition. + */ +typedef struct GlobalTransactionData *GlobalTransaction; + +/* GUC variable */ +extern int max_prepared_xacts; + +extern int TwoPhaseShmemSize(void); +extern void TwoPhaseShmemInit(void); + +extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid); + +extern GlobalTransaction MarkAsPreparing(TransactionId xid, Oid databaseid, + char *gid, AclId owner); +extern void MarkAsPrepared(GlobalTransaction gxact); + +extern void StartPrepare(GlobalTransaction gxact); +extern void EndPrepare(GlobalTransaction gxact); + +extern TransactionId PrescanPreparedTransactions(void); +extern void RecoverPreparedTransactions(void); + +extern void RecreateTwoPhaseFile(TransactionId xid, void *content, int len); +extern void RemoveTwoPhaseFile(TransactionId xid, bool giveWarning); + +extern void FinishPreparedTransaction(char *gid, bool isCommit); + +#endif /* TWOPHASE_H */ diff --git a/src/include/access/twophase_rmgr.h b/src/include/access/twophase_rmgr.h new file mode 100644 index 00000000000..f15233ba2f6 --- /dev/null +++ b/src/include/access/twophase_rmgr.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * twophase_rmgr.h + * Two-phase-commit resource managers definition + * + * + * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $PostgreSQL: pgsql/src/include/access/twophase_rmgr.h,v 1.1 2005/06/17 22:32:48 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef TWOPHASE_RMGR_H +#define TWOPHASE_RMGR_H + +typedef void (*TwoPhaseCallback) (TransactionId xid, uint16 info, + void *recdata, uint32 len); +typedef uint8 TwoPhaseRmgrId; + +/* + * Built-in resource managers + */ +#define TWOPHASE_RM_END_ID 0 +#define TWOPHASE_RM_LOCK_ID 1 +#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 + +extern const TwoPhaseCallback twophase_recover_callbacks[]; +extern const TwoPhaseCallback twophase_postcommit_callbacks[]; +extern const TwoPhaseCallback twophase_postabort_callbacks[]; + + +extern void RegisterTwoPhaseRecord(TwoPhaseRmgrId rmid, uint16 info, + const void *data, uint32 len); + +#endif /* TWOPHASE_RMGR_H */ diff --git a/src/include/access/xact.h b/src/include/access/xact.h index 7c949899ac4..0c6b5580688 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.76 2005/06/06 17:01:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.77 2005/06/17 22:32:48 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,8 @@ extern bool XactReadOnly; typedef enum { XACT_EVENT_COMMIT, - XACT_EVENT_ABORT + XACT_EVENT_ABORT, + XACT_EVENT_PREPARE } XactEvent; typedef void (*XactCallback) (XactEvent event, void *arg); @@ -72,8 +73,11 @@ typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, * XLOG allows to store some information in high 4 bits of log * record xl_info field */ -#define XLOG_XACT_COMMIT 0x00 -#define XLOG_XACT_ABORT 0x20 +#define XLOG_XACT_COMMIT 0x00 +#define XLOG_XACT_PREPARE 0x10 +#define XLOG_XACT_ABORT 0x20 +#define XLOG_XACT_COMMIT_PREPARED 0x30 +#define XLOG_XACT_ABORT_PREPARED 0x40 typedef struct xl_xact_commit { @@ -99,6 +103,31 @@ typedef struct xl_xact_abort #define MinSizeOfXactAbort offsetof(xl_xact_abort, xnodes) +/* + * COMMIT_PREPARED and ABORT_PREPARED are identical to COMMIT/ABORT records + * except that we have to store the XID of the prepared transaction explicitly + * --- the XID in the record header will be for the transaction doing the + * COMMIT PREPARED or ABORT PREPARED command. + */ + +typedef struct xl_xact_commit_prepared +{ + TransactionId xid; /* XID of prepared xact */ + xl_xact_commit crec; /* COMMIT record */ + /* MORE DATA FOLLOWS AT END OF STRUCT */ +} xl_xact_commit_prepared; + +#define MinSizeOfXactCommitPrepared offsetof(xl_xact_commit_prepared, crec.xnodes) + +typedef struct xl_xact_abort_prepared +{ + TransactionId xid; /* XID of prepared xact */ + xl_xact_abort arec; /* ABORT record */ + /* MORE DATA FOLLOWS AT END OF STRUCT */ +} xl_xact_abort_prepared; + +#define MinSizeOfXactAbortPrepared offsetof(xl_xact_abort_prepared, arec.xnodes) + /* ---------------- * extern definitions @@ -121,6 +150,7 @@ extern void CommitTransactionCommand(void); extern void AbortCurrentTransaction(void); extern void BeginTransactionBlock(void); extern bool EndTransactionBlock(void); +extern bool PrepareTransactionBlock(char *gid); extern void UserAbortTransactionBlock(void); extern void ReleaseSavepoint(List *options); extern void DefineSavepoint(char *name); diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 535e5bb01ba..de422a41a9f 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.276 2005/06/15 12:56:35 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.277 2005/06/17 22:32:48 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200506151 +#define CATALOG_VERSION_NO 200506171 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index c06c4a7d41f..a05a4f3a62c 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.367 2005/06/14 21:04:41 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.368 2005/06/17 22:32:48 tgl Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -3005,6 +3005,8 @@ DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 f f t t s 0 2249 " DESCR("SHOW ALL as a function"); DATA(insert OID = 1371 ( pg_lock_status PGNSP PGUID 12 f f t t v 0 2249 "" _null_ _null_ _null_ pg_lock_status - _null_ )); DESCR("view system lock information"); +DATA(insert OID = 1065 ( pg_prepared_xact PGNSP PGUID 12 f f t t v 0 2249 "" _null_ _null_ _null_ pg_prepared_xact - _null_ )); +DESCR("view two-phase transactions"); DATA(insert OID = 2079 ( pg_table_is_visible PGNSP PGUID 12 f f t f s 1 16 "26" _null_ _null_ _null_ pg_table_is_visible - _null_ )); DESCR("is table visible in search path?"); diff --git a/src/include/commands/async.h b/src/include/commands/async.h index 08855ea5403..b893771b0f7 100644 --- a/src/include/commands/async.h +++ b/src/include/commands/async.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.27 2004/12/31 22:03:28 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.28 2005/06/17 22:32:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -26,6 +26,7 @@ extern void AtAbort_Notify(void); extern void AtSubStart_Notify(void); extern void AtSubCommit_Notify(void); extern void AtSubAbort_Notify(void); +extern void AtPrepare_Notify(void); /* signal handler for inbound notifies (SIGUSR2) */ extern void NotifyInterruptHandler(SIGNAL_ARGS); @@ -38,4 +39,7 @@ extern void NotifyInterruptHandler(SIGNAL_ARGS); extern void EnableNotifyInterrupt(void); extern bool DisableNotifyInterrupt(void); +extern void notify_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); + #endif /* ASYNC_H */ diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 04b32082ebf..993a240faa1 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.281 2005/06/05 22:32:57 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.282 2005/06/17 22:32:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1556,7 +1556,10 @@ typedef enum TransactionStmtKind TRANS_STMT_ROLLBACK, TRANS_STMT_SAVEPOINT, TRANS_STMT_RELEASE, - TRANS_STMT_ROLLBACK_TO + TRANS_STMT_ROLLBACK_TO, + TRANS_STMT_PREPARE, + TRANS_STMT_COMMIT_PREPARED, + TRANS_STMT_ROLLBACK_PREPARED } TransactionStmtKind; typedef struct TransactionStmt @@ -1564,6 +1567,7 @@ typedef struct TransactionStmt NodeTag type; TransactionStmtKind kind; /* see above */ List *options; /* for BEGIN/START and savepoint commands */ + char *gid; /* for two-phase-commit related commands */ } TransactionStmt; /* ---------------------- diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h index d08d0f10be0..3d325b10af6 100644 --- a/src/include/storage/ipc.h +++ b/src/include/storage/ipc.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.70 2004/12/31 22:03:42 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.71 2005/06/17 22:32:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,8 +29,6 @@ extern void on_shmem_exit(void (*function) (int code, Datum arg), Datum arg); extern void on_exit_reset(void); /* ipci.c */ -extern void CreateSharedMemoryAndSemaphores(bool makePrivate, - int maxBackends, - int port); +extern void CreateSharedMemoryAndSemaphores(bool makePrivate, int port); #endif /* IPC_H */ diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index cdbf8ad406c..3a83c26c7df 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.49 2005/06/14 22:15:33 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.50 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ * so increase that if you want to add more modes. */ -extern void InitLockTable(int maxBackends); +extern void InitLockTable(void); extern void RelationInitLockInfo(Relation relation); /* Lock a relation */ diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index a471ff32a33..e434683d0e5 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.88 2005/06/14 22:15:33 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.89 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -370,7 +370,7 @@ extern void InitLocks(void); extern LockMethod GetLocksMethodTable(LOCK *lock); extern LOCKMETHODID LockMethodTableInit(const char *tabName, const LOCKMASK *conflictsP, - int numModes, int maxBackends); + int numModes); extern LOCKMETHODID LockMethodTableRename(LOCKMETHODID lockmethodid); extern LockAcquireResult LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag, @@ -383,13 +383,15 @@ extern bool LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag, extern void LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks); extern void LockReleaseCurrentOwner(void); extern void LockReassignCurrentOwner(void); +extern void AtPrepare_Locks(void); +extern void PostPrepare_Locks(TransactionId xid); extern int LockCheckConflicts(LockMethod lockMethodTable, LOCKMODE lockmode, LOCK *lock, PROCLOCK *proclock, PGPROC *proc); extern void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode); extern void GrantAwaitedLock(void); extern void RemoveFromWaitQueue(PGPROC *proc); -extern int LockShmemSize(int maxBackends); +extern int LockShmemSize(void); extern bool DeadLockCheck(PGPROC *proc); extern void DeadLockReport(void); extern void RememberSimpleDeadLock(PGPROC *proc1, @@ -400,8 +402,15 @@ extern void InitDeadLockChecking(void); extern LockData *GetLockStatusData(void); extern const char *GetLockmodeName(LOCKMODE mode); +extern void lock_twophase_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_postabort(TransactionId xid, uint16 info, + void *recdata, uint32 len); + #ifdef LOCK_DEBUG -extern void DumpLocks(void); +extern void DumpLocks(PGPROC *proc); extern void DumpAllLocks(void); #endif diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index eb45f3e39ae..b4ebdb85d59 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.19 2005/05/19 21:35:47 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.20 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ typedef enum LWLockId MultiXactMemberControlLock, RelCacheInitLock, BgWriterCommLock, + TwoPhaseStateLock, NumFixedLWLocks, /* must be last except for * MaxDynamicLWLock */ diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index f771d71933c..ece321028fc 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.78 2005/05/19 21:35:47 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.79 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -46,6 +46,13 @@ struct XidCache * links: list link for any list the PGPROC is in. When waiting for a lock, * the PGPROC is linked into that lock's waitProcs queue. A recycled PGPROC * is linked into ProcGlobal's freeProcs list. + * + * Note: twophase.c also sets up a dummy PGPROC struct for each currently + * prepared transaction. These PGPROCs appear in the ProcArray data structure + * so that the prepared transactions appear to be still running and are + * correctly shown as holding locks. A prepared transaction PGPROC can be + * distinguished from a real one at need by the fact that it has pid == 0. + * The semaphore and lock-related fields in a prepared-xact PGPROC are unused. */ struct PGPROC { @@ -62,16 +69,9 @@ struct PGPROC * were starting our xact: vacuum must not * remove tuples deleted by xid >= xmin ! */ - int pid; /* This backend's process id */ + int pid; /* This backend's process id, or 0 */ Oid databaseId; /* OID of database this backend is using */ - /* - * XLOG location of first XLOG record written by this backend's - * current transaction. If backend is not in a transaction or hasn't - * yet modified anything, logRec.xrecoff is zero. - */ - XLogRecPtr logRec; - /* Info about LWLock the process is currently waiting for, if any. */ bool lwWaiting; /* true if waiting for an LW lock */ bool lwExclusive; /* true if waiting for exclusive access */ @@ -120,11 +120,12 @@ extern int StatementTimeout; /* * Function Prototypes */ -extern int ProcGlobalSemas(int maxBackends); -extern int ProcGlobalShmemSize(int maxBackends); -extern void InitProcGlobal(int maxBackends); +extern int ProcGlobalSemas(void); +extern int ProcGlobalShmemSize(void); +extern void InitProcGlobal(void); extern void InitProcess(void); extern void InitDummyProcess(int proctype); +extern bool HaveNFreeProcs(int n); extern void ProcReleaseLocks(bool isCommit); extern void ProcQueueInit(PROC_QUEUE *queue); diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h index 437ac306e05..d1780bcca18 100644 --- a/src/include/storage/procarray.h +++ b/src/include/storage/procarray.h @@ -7,28 +7,30 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.1 2005/05/19 21:35:47 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.2 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef PROCARRAY_H #define PROCARRAY_H -extern int ProcArrayShmemSize(int maxBackends); -extern void CreateSharedProcArray(int maxBackends); -extern void ProcArrayAddMyself(void); -extern void ProcArrayRemoveMyself(void); +#include "storage/lock.h" + + +extern int ProcArrayShmemSize(void); +extern void CreateSharedProcArray(void); +extern void ProcArrayAdd(PGPROC *proc); +extern void ProcArrayRemove(PGPROC *proc); extern bool TransactionIdIsInProgress(TransactionId xid); +extern bool TransactionIdIsActive(TransactionId xid); extern TransactionId GetOldestXmin(bool allDbs); -/* Use "struct PGPROC", not PGPROC, to avoid including proc.h here */ -extern struct PGPROC *BackendPidGetProc(int pid); +extern PGPROC *BackendPidGetProc(int pid); extern bool IsBackendPid(int pid); extern bool DatabaseHasActiveBackends(Oid databaseId, bool ignoreMyself); extern int CountActiveBackends(void); -extern int CountEmptyBackendSlots(void); extern void XidCacheRemoveRunningXids(TransactionId xid, int nxids, TransactionId *xids); diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index f00a8aeb833..ab3c39fd1c6 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.51 2005/06/06 17:01:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.52 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -79,6 +79,7 @@ extern void smgrDoPendingDeletes(bool isCommit); extern int smgrGetPendingDeletes(bool forCommit, RelFileNode **ptr); extern void AtSubCommit_smgr(void); extern void AtSubAbort_smgr(void); +extern void PostPrepare_smgr(void); extern void smgrcommit(void); extern void smgrabort(void); extern void smgrsync(void); diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index b781a270c60..37423dc73c2 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.257 2005/05/27 00:57:49 neilc Exp $ + * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.258 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -825,6 +825,9 @@ extern Datum show_all_settings(PG_FUNCTION_ARGS); /* lockfuncs.c */ extern Datum pg_lock_status(PG_FUNCTION_ARGS); +/* access/transam/twophase.c */ +extern Datum pg_prepared_xact(PG_FUNCTION_ARGS); + /* catalog/pg_conversion.c */ extern Datum pg_convert_using(PG_FUNCTION_ARGS); diff --git a/src/include/utils/flatfiles.h b/src/include/utils/flatfiles.h index 04a901ab008..939239aa1b9 100644 --- a/src/include/utils/flatfiles.h +++ b/src/include/utils/flatfiles.h @@ -4,7 +4,7 @@ * Routines for maintaining "flat file" images of the shared catalogs. * * - * $PostgreSQL: pgsql/src/include/utils/flatfiles.h,v 1.3 2005/05/10 22:27:30 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/flatfiles.h,v 1.4 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,6 +23,7 @@ extern char *user_getflatfilename(void); extern void BuildFlatFiles(bool database_only); +extern void AtPrepare_UpdateFlatFiles(void); extern void AtEOXact_UpdateFlatFiles(bool isCommit); extern void AtEOSubXact_UpdateFlatFiles(bool isCommit, SubTransactionId mySubid, @@ -30,4 +31,7 @@ extern void AtEOSubXact_UpdateFlatFiles(bool isCommit, extern Datum flatfile_update_trigger(PG_FUNCTION_ARGS); +extern void flatfile_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); + #endif /* FLATFILES_H */ diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h index ac486e53ea0..372d34a22c3 100644 --- a/src/include/utils/inval.h +++ b/src/include/utils/inval.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/inval.h,v 1.35 2004/12/31 22:03:46 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/utils/inval.h,v 1.36 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -30,6 +30,10 @@ extern void AtEOXact_Inval(bool isCommit); extern void AtEOSubXact_Inval(bool isCommit); +extern void AtPrepare_Inval(void); + +extern void PostPrepare_Inval(void); + extern void CommandEndInvalidationMessages(void); extern void CacheInvalidateHeapTuple(Relation relation, HeapTuple tuple); @@ -47,4 +51,7 @@ extern void CacheRegisterSyscacheCallback(int cacheid, extern void CacheRegisterRelcacheCallback(CacheCallbackFunction func, Datum arg); +extern void inval_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); + #endif /* INVAL_H */ diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h index b8bcc33f583..33de53eee86 100644 --- a/src/include/utils/portal.h +++ b/src/include/utils/portal.h @@ -39,7 +39,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.55 2005/04/11 19:51:16 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.56 2005/06/17 22:32:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -183,6 +183,7 @@ typedef struct PortalData /* Prototypes for functions in utils/mmgr/portalmem.c */ extern void EnablePortalManager(void); extern bool CommitHoldablePortals(void); +extern bool PrepareHoldablePortals(void); extern void AtCommit_Portals(void); extern void AtAbort_Portals(void); extern void AtCleanup_Portals(void); |