Header And Logo

PostgreSQL
| The world's most advanced open source database.

twophase.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * twophase.h
00004  *    Two-phase-commit related declarations.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/access/twophase.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef TWOPHASE_H
00015 #define TWOPHASE_H
00016 
00017 #include "access/xlogdefs.h"
00018 #include "datatype/timestamp.h"
00019 #include "storage/lock.h"
00020 
00021 /*
00022  * GlobalTransactionData is defined in twophase.c; other places have no
00023  * business knowing the internal definition.
00024  */
00025 typedef struct GlobalTransactionData *GlobalTransaction;
00026 
00027 /* GUC variable */
00028 extern int  max_prepared_xacts;
00029 
00030 extern Size TwoPhaseShmemSize(void);
00031 extern void TwoPhaseShmemInit(void);
00032 
00033 extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid);
00034 extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid);
00035 
00036 extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid,
00037                 TimestampTz prepared_at,
00038                 Oid owner, Oid databaseid);
00039 
00040 extern void StartPrepare(GlobalTransaction gxact);
00041 extern void EndPrepare(GlobalTransaction gxact);
00042 extern bool StandbyTransactionIdIsPrepared(TransactionId xid);
00043 
00044 extern TransactionId PrescanPreparedTransactions(TransactionId **xids_p,
00045                             int *nxids_p);
00046 extern void StandbyRecoverPreparedTransactions(bool overwriteOK);
00047 extern void RecoverPreparedTransactions(void);
00048 
00049 extern void RecreateTwoPhaseFile(TransactionId xid, void *content, int len);
00050 extern void RemoveTwoPhaseFile(TransactionId xid, bool giveWarning);
00051 
00052 extern void CheckPointTwoPhase(XLogRecPtr redo_horizon);
00053 
00054 extern void FinishPreparedTransaction(const char *gid, bool isCommit);
00055 
00056 #endif   /* TWOPHASE_H */