]> granicus.if.org Git - postgresql/blob - src/include/storage/standby.h
Remove prototype for nonexistent function.
[postgresql] / src / include / storage / standby.h
1 /*-------------------------------------------------------------------------
2  *
3  * standby.h
4  *        Definitions for hot standby mode.
5  *
6  *
7  * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/storage/standby.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef STANDBY_H
15 #define STANDBY_H
16
17 #include "access/xlog.h"
18 #include "storage/lock.h"
19 #include "storage/procsignal.h"
20 #include "storage/relfilenode.h"
21
22 /* User-settable GUC parameters */
23 extern int      vacuum_defer_cleanup_age;
24 extern int      max_standby_archive_delay;
25 extern int      max_standby_streaming_delay;
26
27 extern void InitRecoveryTransactionEnvironment(void);
28 extern void ShutdownRecoveryTransactionEnvironment(void);
29
30 extern void ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid,
31                                                                         RelFileNode node);
32 extern void ResolveRecoveryConflictWithTablespace(Oid tsid);
33 extern void ResolveRecoveryConflictWithDatabase(Oid dbid);
34
35 extern void ResolveRecoveryConflictWithBufferPin(void);
36 extern void SendRecoveryConflictWithBufferPin(ProcSignalReason reason);
37 extern void CheckRecoveryConflictDeadlock(void);
38
39 /*
40  * Standby Rmgr (RM_STANDBY_ID)
41  *
42  * Standby recovery manager exists to perform actions that are required
43  * to make hot standby work. That includes logging AccessExclusiveLocks taken
44  * by transactions and running-xacts snapshots.
45  */
46 extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid);
47 extern void StandbyReleaseLockTree(TransactionId xid,
48                                            int nsubxids, TransactionId *subxids);
49 extern void StandbyReleaseAllLocks(void);
50 extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids);
51
52 /*
53  * XLOG message types
54  */
55 #define XLOG_STANDBY_LOCK                       0x00
56 #define XLOG_RUNNING_XACTS                      0x10
57
58 typedef struct xl_standby_locks
59 {
60         int                     nlocks;                 /* number of entries in locks array */
61         xl_standby_lock locks[1];       /* VARIABLE LENGTH ARRAY */
62 } xl_standby_locks;
63
64 /*
65  * When we write running xact data to WAL, we use this structure.
66  */
67 typedef struct xl_running_xacts
68 {
69         int                     xcnt;                   /* # of xact ids in xids[] */
70         bool            subxid_overflow;        /* snapshot overflowed, subxids missing */
71         TransactionId nextXid;          /* copy of ShmemVariableCache->nextXid */
72         TransactionId oldestRunningXid;         /* *not* oldestXmin */
73         TransactionId latestCompletedXid;       /* so we can set xmax */
74
75         TransactionId xids[1];          /* VARIABLE LENGTH ARRAY */
76 } xl_running_xacts;
77
78 #define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids)
79
80
81 /* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
82 extern void standby_redo(XLogRecPtr lsn, XLogRecord *record);
83 extern void standby_desc(StringInfo buf, uint8 xl_info, char *rec);
84
85 /*
86  * Declarations for GetRunningTransactionData(). Similar to Snapshots, but
87  * not quite. This has nothing at all to do with visibility on this server,
88  * so this is completely separate from snapmgr.c and snapmgr.h.
89  * This data is important for creating the initial snapshot state on a
90  * standby server. We need lots more information than a normal snapshot,
91  * hence we use a specific data structure for our needs. This data
92  * is written to WAL as a separate record immediately after each
93  * checkpoint. That means that wherever we start a standby from we will
94  * almost immediately see the data we need to begin executing queries.
95  */
96
97 typedef struct RunningTransactionsData
98 {
99         int                     xcnt;                   /* # of xact ids in xids[] */
100         bool            subxid_overflow;        /* snapshot overflowed, subxids missing */
101         TransactionId nextXid;          /* copy of ShmemVariableCache->nextXid */
102         TransactionId oldestRunningXid;         /* *not* oldestXmin */
103         TransactionId latestCompletedXid;       /* so we can set xmax */
104
105         TransactionId *xids;            /* array of (sub)xids still running */
106 } RunningTransactionsData;
107
108 typedef RunningTransactionsData *RunningTransactions;
109
110 extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid);
111 extern void LogAccessExclusiveLockPrepare(void);
112
113 extern void LogStandbySnapshot(TransactionId *nextXid);
114
115 #endif   /* STANDBY_H */