PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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-2024, 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/xact.h"
18#include "access/xlogdefs.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
31extern Size TwoPhaseShmemSize(void);
32extern void TwoPhaseShmemInit(void);
33
34extern void AtAbort_Twophase(void);
35extern void PostPrepare_Twophase(void);
36
38 bool *have_more);
39extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid, bool lock_held);
40extern int TwoPhaseGetDummyProcNumber(TransactionId xid, bool lock_held);
41
44 Oid owner, Oid databaseid);
45
46extern void StartPrepare(GlobalTransaction gxact);
47extern void EndPrepare(GlobalTransaction gxact);
49
51 int *nxids_p);
53extern void RecoverPreparedTransactions(void);
54
55extern void CheckPointTwoPhase(XLogRecPtr redo_horizon);
56
57extern void FinishPreparedTransaction(const char *gid, bool isCommit);
58
59extern void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn,
60 XLogRecPtr end_lsn, RepOriginId origin_id);
61extern void PrepareRedoRemove(TransactionId xid, bool giveWarning);
62extern void restoreTwoPhaseData(void);
63extern bool LookupGXact(const char *gid, XLogRecPtr prepare_end_lsn,
64 TimestampTz origin_prepare_timestamp);
65
66extern void TwoPhaseTransactionGid(Oid subid, TransactionId xid, char *gid_res,
67 int szgid);
68extern bool LookupGXactBySubid(Oid subid);
69
70#endif /* TWOPHASE_H */
#define PGDLLIMPORT
Definition: c.h:1274
uint32 TransactionId
Definition: c.h:606
size_t Size
Definition: c.h:559
int64 TimestampTz
Definition: timestamp.h:39
static char * buf
Definition: pg_test_fsync.c:72
unsigned int Oid
Definition: postgres_ext.h:31
TimestampTz prepared_at
Definition: twophase.c:151
TransactionId xid
Definition: twophase.c:162
XLogRecPtr prepare_end_lsn
Definition: twophase.c:161
char gid[GIDSIZE]
Definition: twophase.c:169
Definition: proc.h:162
void TwoPhaseTransactionGid(Oid subid, TransactionId xid, char *gid_res, int szgid)
Definition: twophase.c:2763
void RecoverPreparedTransactions(void)
Definition: twophase.c:2108
struct GlobalTransactionData * GlobalTransaction
Definition: twophase.h:26
void restoreTwoPhaseData(void)
Definition: twophase.c:1907
bool LookupGXact(const char *gid, XLogRecPtr prepare_end_lsn, TimestampTz origin_prepare_timestamp)
Definition: twophase.c:2704
Size TwoPhaseShmemSize(void)
Definition: twophase.c:237
void AtAbort_Twophase(void)
Definition: twophase.c:304
void FinishPreparedTransaction(const char *gid, bool isCommit)
Definition: twophase.c:1491
TransactionId TwoPhaseGetXidByVirtualXID(VirtualTransactionId vxid, bool *have_more)
Definition: twophase.c:852
void PrepareRedoRemove(TransactionId xid, bool giveWarning)
Definition: twophase.c:2644
void EndPrepare(GlobalTransaction gxact)
Definition: twophase.c:1143
TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
Definition: twophase.c:1968
void StartPrepare(GlobalTransaction gxact)
Definition: twophase.c:1050
void TwoPhaseShmemInit(void)
Definition: twophase.c:253
void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn, XLogRecPtr end_lsn, RepOriginId origin_id)
Definition: twophase.c:2539
void StandbyRecoverPreparedTransactions(void)
Definition: twophase.c:2055
PGPROC * TwoPhaseGetDummyProc(TransactionId xid, bool lock_held)
Definition: twophase.c:918
void PostPrepare_Twophase(void)
Definition: twophase.c:344
bool LookupGXactBySubid(Oid subid)
Definition: twophase.c:2813
int TwoPhaseGetDummyProcNumber(TransactionId xid, bool lock_held)
Definition: twophase.c:903
void CheckPointTwoPhase(XLogRecPtr redo_horizon)
Definition: twophase.c:1823
bool StandbyTransactionIdIsPrepared(TransactionId xid)
Definition: twophase.c:1463
GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid, TimestampTz prepared_at, Oid owner, Oid databaseid)
Definition: twophase.c:359
PGDLLIMPORT int max_prepared_xacts
Definition: twophase.c:115
uint16 RepOriginId
Definition: xlogdefs.h:65
uint64 XLogRecPtr
Definition: xlogdefs.h:21