PostgreSQL Source Code  git master
twophase.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * twophase.h
4  * Two-phase-commit related declarations.
5  *
6  *
7  * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/access/twophase.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef TWOPHASE_H
15 #define TWOPHASE_H
16 
17 #include "access/xlogdefs.h"
18 #include "access/xact.h"
19 #include "datatype/timestamp.h"
20 #include "storage/lock.h"
21 
22 /*
23  * GlobalTransactionData is defined in twophase.c; other places have no
24  * business knowing the internal definition.
25  */
27 
28 /* GUC variable */
30 
31 extern Size TwoPhaseShmemSize(void);
32 extern void TwoPhaseShmemInit(void);
33 
34 extern void AtAbort_Twophase(void);
35 extern void PostPrepare_Twophase(void);
36 
39 
40 extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid,
42  Oid owner, Oid databaseid);
43 
44 extern void StartPrepare(GlobalTransaction gxact);
45 extern void EndPrepare(GlobalTransaction gxact);
47 
49  int *nxids_p);
50 extern void ParsePrepareRecord(uint8 info, char *xlrec,
51  xl_xact_parsed_prepare *parsed);
52 extern void StandbyRecoverPreparedTransactions(void);
53 extern void RecoverPreparedTransactions(void);
54 
55 extern void CheckPointTwoPhase(XLogRecPtr redo_horizon);
56 
57 extern void FinishPreparedTransaction(const char *gid, bool isCommit);
58 
59 extern void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn,
60  XLogRecPtr end_lsn, RepOriginId origin_id);
61 extern void PrepareRedoRemove(TransactionId xid, bool giveWarning);
62 extern void restoreTwoPhaseData(void);
63 #endif /* TWOPHASE_H */
void AtAbort_Twophase(void)
Definition: twophase.c:317
void restoreTwoPhaseData(void)
Definition: twophase.c:1804
void PostPrepare_Twophase(void)
Definition: twophase.c:357
void FinishPreparedTransaction(const char *gid, bool isCommit)
Definition: twophase.c:1433
uint32 TransactionId
Definition: c.h:474
void EndPrepare(GlobalTransaction gxact)
Definition: twophase.c:1064
int64 TimestampTz
Definition: timestamp.h:39
unsigned char uint8
Definition: c.h:323
uint16 RepOriginId
Definition: xlogdefs.h:51
void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn, XLogRecPtr end_lsn, RepOriginId origin_id)
Definition: twophase.c:2386
struct GlobalTransactionData * GlobalTransaction
Definition: twophase.h:26
unsigned int Oid
Definition: postgres_ext.h:31
void CheckPointTwoPhase(XLogRecPtr redo_horizon)
Definition: twophase.c:1722
char gid[GIDSIZE]
Definition: twophase.c:172
#define PGDLLIMPORT
Definition: c.h:1140
void TwoPhaseShmemInit(void)
Definition: twophase.c:252
PGPROC * TwoPhaseGetDummyProc(TransactionId xid)
Definition: twophase.c:866
void StartPrepare(GlobalTransaction gxact)
Definition: twophase.c:991
static char * buf
Definition: pg_test_fsync.c:67
void StandbyRecoverPreparedTransactions(void)
Definition: twophase.c:1942
GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid, TimestampTz prepared_at, Oid owner, Oid databaseid)
Definition: twophase.c:372
int BackendId
Definition: backendid.h:21
void RecoverPreparedTransactions(void)
Definition: twophase.c:1983
uint64 XLogRecPtr
Definition: xlogdefs.h:21
BackendId TwoPhaseGetDummyBackendId(TransactionId xid)
Definition: twophase.c:854
size_t Size
Definition: c.h:433
TransactionId xid
Definition: twophase.c:165
TimestampTz prepared_at
Definition: twophase.c:154
void PrepareRedoRemove(TransactionId xid, bool giveWarning)
Definition: twophase.c:2456
void ParsePrepareRecord(uint8 info, char *xlrec, xl_xact_parsed_prepare *parsed)
Definition: twophase.c:1317
PGDLLIMPORT int max_prepared_xacts
Definition: twophase.c:117
bool StandbyTransactionIdIsPrepared(TransactionId xid)
Definition: twophase.c:1405
Definition: proc.h:95
TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
Definition: twophase.c:1862
Size TwoPhaseShmemSize(void)
Definition: twophase.c:236