Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef STANDBY_H
00015 #define STANDBY_H
00016
00017 #include "access/xlog.h"
00018 #include "storage/lock.h"
00019 #include "storage/procsignal.h"
00020 #include "storage/relfilenode.h"
00021
00022
00023 extern int vacuum_defer_cleanup_age;
00024 extern int max_standby_archive_delay;
00025 extern int max_standby_streaming_delay;
00026
00027 extern void InitRecoveryTransactionEnvironment(void);
00028 extern void ShutdownRecoveryTransactionEnvironment(void);
00029
00030 extern void ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid,
00031 RelFileNode node);
00032 extern void ResolveRecoveryConflictWithTablespace(Oid tsid);
00033 extern void ResolveRecoveryConflictWithDatabase(Oid dbid);
00034
00035 extern void ResolveRecoveryConflictWithBufferPin(void);
00036 extern void CheckRecoveryConflictDeadlock(void);
00037 extern void StandbyDeadLockHandler(void);
00038 extern void StandbyTimeoutHandler(void);
00039
00040
00041
00042
00043
00044
00045
00046
00047 extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid);
00048 extern void StandbyReleaseLockTree(TransactionId xid,
00049 int nsubxids, TransactionId *subxids);
00050 extern void StandbyReleaseAllLocks(void);
00051 extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids);
00052
00053
00054
00055
00056 #define XLOG_STANDBY_LOCK 0x00
00057 #define XLOG_RUNNING_XACTS 0x10
00058
00059 typedef struct xl_standby_locks
00060 {
00061 int nlocks;
00062 xl_standby_lock locks[1];
00063 } xl_standby_locks;
00064
00065
00066
00067
00068 typedef struct xl_running_xacts
00069 {
00070 int xcnt;
00071 int subxcnt;
00072 bool subxid_overflow;
00073 TransactionId nextXid;
00074 TransactionId oldestRunningXid;
00075 TransactionId latestCompletedXid;
00076
00077 TransactionId xids[1];
00078 } xl_running_xacts;
00079
00080 #define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids)
00081
00082
00083
00084 extern void standby_redo(XLogRecPtr lsn, XLogRecord *record);
00085 extern void standby_desc(StringInfo buf, uint8 xl_info, char *rec);
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 typedef struct RunningTransactionsData
00100 {
00101 int xcnt;
00102 int subxcnt;
00103 bool subxid_overflow;
00104 TransactionId nextXid;
00105 TransactionId oldestRunningXid;
00106 TransactionId latestCompletedXid;
00107
00108 TransactionId *xids;
00109 } RunningTransactionsData;
00110
00111 typedef RunningTransactionsData *RunningTransactions;
00112
00113 extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid);
00114 extern void LogAccessExclusiveLockPrepare(void);
00115
00116 extern void LogStandbySnapshot(void);
00117
00118 #endif