Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TRANSAM_H
00015 #define TRANSAM_H
00016
00017 #include "access/xlogdefs.h"
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #define InvalidTransactionId ((TransactionId) 0)
00032 #define BootstrapTransactionId ((TransactionId) 1)
00033 #define FrozenTransactionId ((TransactionId) 2)
00034 #define FirstNormalTransactionId ((TransactionId) 3)
00035 #define MaxTransactionId ((TransactionId) 0xFFFFFFFF)
00036
00037
00038
00039
00040
00041 #define TransactionIdIsValid(xid) ((xid) != InvalidTransactionId)
00042 #define TransactionIdIsNormal(xid) ((xid) >= FirstNormalTransactionId)
00043 #define TransactionIdEquals(id1, id2) ((id1) == (id2))
00044 #define TransactionIdStore(xid, dest) (*(dest) = (xid))
00045 #define StoreInvalidTransactionId(dest) (*(dest) = InvalidTransactionId)
00046
00047
00048 #define TransactionIdAdvance(dest) \
00049 do { \
00050 (dest)++; \
00051 if ((dest) < FirstNormalTransactionId) \
00052 (dest) = FirstNormalTransactionId; \
00053 } while(0)
00054
00055
00056 #define TransactionIdRetreat(dest) \
00057 do { \
00058 (dest)--; \
00059 } while ((dest) < FirstNormalTransactionId)
00060
00061
00062 #define NormalTransactionIdPrecedes(id1, id2) \
00063 (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \
00064 (int32) ((id1) - (id2)) < 0)
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 #define FirstBootstrapObjectId 10000
00089 #define FirstNormalObjectId 16384
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 typedef struct VariableCacheData
00102 {
00103
00104
00105
00106 Oid nextOid;
00107 uint32 oidCount;
00108
00109
00110
00111
00112 TransactionId nextXid;
00113
00114 TransactionId oldestXid;
00115 TransactionId xidVacLimit;
00116 TransactionId xidWarnLimit;
00117 TransactionId xidStopLimit;
00118 TransactionId xidWrapLimit;
00119 Oid oldestXidDB;
00120
00121
00122
00123
00124 TransactionId latestCompletedXid;
00125
00126 } VariableCacheData;
00127
00128 typedef VariableCacheData *VariableCache;
00129
00130
00131
00132
00133
00134
00135
00136
00137 extern bool TransactionStartedDuringRecovery(void);
00138
00139
00140 extern PGDLLIMPORT VariableCache ShmemVariableCache;
00141
00142
00143
00144
00145 extern bool TransactionIdDidCommit(TransactionId transactionId);
00146 extern bool TransactionIdDidAbort(TransactionId transactionId);
00147 extern bool TransactionIdIsKnownCompleted(TransactionId transactionId);
00148 extern void TransactionIdAbort(TransactionId transactionId);
00149 extern void TransactionIdCommitTree(TransactionId xid, int nxids, TransactionId *xids);
00150 extern void TransactionIdAsyncCommitTree(TransactionId xid, int nxids, TransactionId *xids, XLogRecPtr lsn);
00151 extern void TransactionIdAbortTree(TransactionId xid, int nxids, TransactionId *xids);
00152 extern bool TransactionIdPrecedes(TransactionId id1, TransactionId id2);
00153 extern bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2);
00154 extern bool TransactionIdFollows(TransactionId id1, TransactionId id2);
00155 extern bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2);
00156 extern TransactionId TransactionIdLatest(TransactionId mainxid,
00157 int nxids, const TransactionId *xids);
00158 extern XLogRecPtr TransactionIdGetCommitLSN(TransactionId xid);
00159
00160
00161 extern TransactionId GetNewTransactionId(bool isSubXact);
00162 extern TransactionId ReadNewTransactionId(void);
00163 extern void SetTransactionIdLimit(TransactionId oldest_datfrozenxid,
00164 Oid oldest_datoid);
00165 extern bool ForceTransactionIdLimitUpdate(void);
00166 extern Oid GetNewObjectId(void);
00167
00168 #endif