PostgreSQL Source Code  git master
standbydefs.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * standbydefs.h
4  * Frontend exposed definitions for hot standby mode.
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/storage/standbydefs.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef STANDBYDEFS_H
15 #define STANDBYDEFS_H
16 
17 #include "access/xlogreader.h"
18 #include "lib/stringinfo.h"
19 #include "storage/lockdefs.h"
20 #include "storage/sinval.h"
21 
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);
27  int nmsgs, SharedInvalidationMessage *msgs,
28  Oid dbId, Oid tsId,
29  bool relcacheInitFileInval);
30 
31 /*
32  * XLOG message types
33  */
34 #define XLOG_STANDBY_LOCK 0x00
35 #define XLOG_RUNNING_XACTS 0x10
36 #define XLOG_INVALIDATIONS 0x20
37 
38 typedef struct xl_standby_locks
39 {
40  int nlocks; /* number of entries in locks array */
43 
44 /*
45  * When we write running xact data to WAL, we use this structure.
46  */
47 typedef struct xl_running_xacts
48 {
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 */
55 
58 
59 /*
60  * Invalidations for standby, currently only when transactions without an
61  * assigned xid commit.
62  */
63 typedef struct xl_invalidations
64 {
65  Oid dbId; /* MyDatabaseId */
66  Oid tsId; /* MyDatabaseTableSpace */
67  bool relcacheInitFileInval; /* invalidate relcache init files */
68  int nmsgs; /* number of shared inval msgs */
71 
72 #define MinSizeOfInvalidations offsetof(xl_invalidations, msgs)
73 
74 #endif /* STANDBYDEFS_H */
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:398
unsigned char uint8
Definition: c.h:504
uint32 TransactionId
Definition: c.h:652
static char * buf
Definition: pg_test_fsync.c:73
unsigned int Oid
Definition: postgres_ext.h:31
void standby_redo(XLogReaderState *record)
Definition: standby.c:1159
struct xl_standby_locks xl_standby_locks
void standby_desc(StringInfo buf, XLogReaderState *record)
Definition: standbydesc.c:47
const char * standby_identify(uint8 info)
Definition: standbydesc.c:79
void standby_desc_invalidations(StringInfo buf, int nmsgs, SharedInvalidationMessage *msgs, Oid dbId, Oid tsId, bool relcacheInitFileInval)
Definition: standbydesc.c:105
struct xl_invalidations xl_invalidations
struct xl_running_xacts xl_running_xacts
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: standbydefs.h:69
bool relcacheInitFileInval
Definition: standbydefs.h:67
TransactionId latestCompletedXid
Definition: standbydefs.h:54
TransactionId oldestRunningXid
Definition: standbydefs.h:53
TransactionId xids[FLEXIBLE_ARRAY_MEMBER]
Definition: standbydefs.h:56
TransactionId nextXid
Definition: standbydefs.h:52
xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER]
Definition: standbydefs.h:41