1 /*-------------------------------------------------------------------------
4 * Frontend exposed definitions for hot standby mode.
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/storage/standbydefs.h
12 *-------------------------------------------------------------------------
17 #include "access/xlogreader.h"
18 #include "lib/stringinfo.h"
19 #include "storage/lockdefs.h"
20 #include "storage/sinval.h"
22 /* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
23 extern void standby_redo(XLogReaderState
*record
);
24 extern void standby_desc(StringInfo buf
, XLogReaderState
*record
);
25 extern const char *standby_identify(uint8 info
);
26 extern void standby_desc_invalidations(StringInfo buf
,
27 int nmsgs
, SharedInvalidationMessage
*msgs
,
29 bool relcacheInitFileInval
);
34 #define XLOG_STANDBY_LOCK 0x00
35 #define XLOG_RUNNING_XACTS 0x10
36 #define XLOG_INVALIDATIONS 0x20
38 typedef struct xl_standby_locks
40 int nlocks
; /* number of entries in locks array */
41 xl_standby_lock locks
[FLEXIBLE_ARRAY_MEMBER
];
45 * When we write running xact data to WAL, we use this structure.
47 typedef struct xl_running_xacts
49 int xcnt
; /* # of xact ids in xids[] */
50 int subxcnt
; /* # of subxact ids in xids[] */
51 bool subxid_overflow
; /* snapshot overflowed, subxids missing */
52 TransactionId nextXid
; /* xid from TransamVariables->nextXid */
53 TransactionId oldestRunningXid
; /* *not* oldestXmin */
54 TransactionId latestCompletedXid
; /* so we can set xmax */
56 TransactionId xids
[FLEXIBLE_ARRAY_MEMBER
];
60 * Invalidations for standby, currently only when transactions without an
61 * assigned xid commit.
63 typedef struct xl_invalidations
65 Oid dbId
; /* MyDatabaseId */
66 Oid tsId
; /* MyDatabaseTableSpace */
67 bool relcacheInitFileInval
; /* invalidate relcache init files */
68 int nmsgs
; /* number of shared inval msgs */
69 SharedInvalidationMessage msgs
[FLEXIBLE_ARRAY_MEMBER
];
72 #define MinSizeOfInvalidations offsetof(xl_invalidations, msgs)
74 #endif /* STANDBYDEFS_H */