Consistently use "superuser" instead of "super user"
[pgsql.git] / src / include / storage / standby.h
blob38fd85a4316c1db8d4a4c6ebcdcc643495206a14
1 /*-------------------------------------------------------------------------
3 * standby.h
4 * Definitions for hot standby mode.
7 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/storage/standby.h
12 *-------------------------------------------------------------------------
14 #ifndef STANDBY_H
15 #define STANDBY_H
17 #include "datatype/timestamp.h"
18 #include "storage/lock.h"
19 #include "storage/procsignal.h"
20 #include "storage/relfilenode.h"
21 #include "storage/standbydefs.h"
23 /* User-settable GUC parameters */
24 extern int vacuum_defer_cleanup_age;
25 extern int max_standby_archive_delay;
26 extern int max_standby_streaming_delay;
27 extern bool log_recovery_conflict_waits;
29 extern void InitRecoveryTransactionEnvironment(void);
30 extern void ShutdownRecoveryTransactionEnvironment(void);
32 extern void ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid,
33 RelFileNode node);
34 extern void ResolveRecoveryConflictWithSnapshotFullXid(FullTransactionId latestRemovedFullXid,
35 RelFileNode node);
36 extern void ResolveRecoveryConflictWithTablespace(Oid tsid);
37 extern void ResolveRecoveryConflictWithDatabase(Oid dbid);
39 extern void ResolveRecoveryConflictWithLock(LOCKTAG locktag, bool logging_conflict);
40 extern void ResolveRecoveryConflictWithBufferPin(void);
41 extern void CheckRecoveryConflictDeadlock(void);
42 extern void StandbyDeadLockHandler(void);
43 extern void StandbyTimeoutHandler(void);
44 extern void StandbyLockTimeoutHandler(void);
45 extern void LogRecoveryConflict(ProcSignalReason reason, TimestampTz wait_start,
46 TimestampTz cur_ts, VirtualTransactionId *wait_list,
47 bool still_waiting);
50 * Standby Rmgr (RM_STANDBY_ID)
52 * Standby recovery manager exists to perform actions that are required
53 * to make hot standby work. That includes logging AccessExclusiveLocks taken
54 * by transactions and running-xacts snapshots.
56 extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid);
57 extern void StandbyReleaseLockTree(TransactionId xid,
58 int nsubxids, TransactionId *subxids);
59 extern void StandbyReleaseAllLocks(void);
60 extern void StandbyReleaseOldLocks(TransactionId oldxid);
62 #define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids)
66 * Declarations for GetRunningTransactionData(). Similar to Snapshots, but
67 * not quite. This has nothing at all to do with visibility on this server,
68 * so this is completely separate from snapmgr.c and snapmgr.h.
69 * This data is important for creating the initial snapshot state on a
70 * standby server. We need lots more information than a normal snapshot,
71 * hence we use a specific data structure for our needs. This data
72 * is written to WAL as a separate record immediately after each
73 * checkpoint. That means that wherever we start a standby from we will
74 * almost immediately see the data we need to begin executing queries.
77 typedef struct RunningTransactionsData
79 int xcnt; /* # of xact ids in xids[] */
80 int subxcnt; /* # of subxact ids in xids[] */
81 bool subxid_overflow; /* snapshot overflowed, subxids missing */
82 TransactionId nextXid; /* xid from ShmemVariableCache->nextXid */
83 TransactionId oldestRunningXid; /* *not* oldestXmin */
84 TransactionId latestCompletedXid; /* so we can set xmax */
86 TransactionId *xids; /* array of (sub)xids still running */
87 } RunningTransactionsData;
89 typedef RunningTransactionsData *RunningTransactions;
91 extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid);
92 extern void LogAccessExclusiveLockPrepare(void);
94 extern XLogRecPtr LogStandbySnapshot(void);
95 extern void LogStandbyInvalidations(int nmsgs, SharedInvalidationMessage *msgs,
96 bool relcacheInitFileInval);
98 #endif /* STANDBY_H */