OSDN Git Service

Fix an old bug in multixact and two-phase commit. Prepared transactions can
[pg-rex/syncrep.git] / src / include / access / twophase.h
1 /*-------------------------------------------------------------------------
2  *
3  * twophase.h
4  *        Two-phase-commit related declarations.
5  *
6  *
7  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * $PostgreSQL: pgsql/src/include/access/twophase.h,v 1.12 2009/11/23 09:58:36 heikki Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef TWOPHASE_H
15 #define TWOPHASE_H
16
17 #include "access/xlogdefs.h"
18 #include "storage/backendid.h"
19 #include "storage/proc.h"
20 #include "utils/timestamp.h"
21
22 /*
23  * GlobalTransactionData is defined in twophase.c; other places have no
24  * business knowing the internal definition.
25  */
26 typedef struct GlobalTransactionData *GlobalTransaction;
27
28 /* GUC variable */
29 extern int      max_prepared_xacts;
30
31 extern Size TwoPhaseShmemSize(void);
32 extern void TwoPhaseShmemInit(void);
33
34 extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid);
35 extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid);
36
37 extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid,
38                                 TimestampTz prepared_at,
39                                 Oid owner, Oid databaseid);
40
41 extern void StartPrepare(GlobalTransaction gxact);
42 extern void EndPrepare(GlobalTransaction gxact);
43
44 extern TransactionId PrescanPreparedTransactions(void);
45 extern void RecoverPreparedTransactions(void);
46
47 extern void RecreateTwoPhaseFile(TransactionId xid, void *content, int len);
48 extern void RemoveTwoPhaseFile(TransactionId xid, bool giveWarning);
49
50 extern void CheckPointTwoPhase(XLogRecPtr redo_horizon);
51
52 extern void FinishPreparedTransaction(const char *gid, bool isCommit);
53
54 #endif   /* TWOPHASE_H */