PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
standbydefs.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * standbydef.h
4  * Frontend exposed definitions for hot standby mode.
5  *
6  *
7  * Portions Copyright (c) 1996-2017, 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 */
41  xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER];
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; /* copy of ShmemVariableCache->nextXid */
53  TransactionId oldestRunningXid; /* *not* oldestXmin */
54  TransactionId latestCompletedXid; /* so we can set xmax */
55 
56  TransactionId xids[FLEXIBLE_ARRAY_MEMBER];
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 file */
68  int nmsgs; /* number of shared inval msgs */
69  SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER];
71 
72 #define MinSizeOfInvalidations offsetof(xl_invalidations, msgs)
73 
74 #endif /* STANDBYDEFS_H */
uint32 TransactionId
Definition: c.h:394
unsigned char uint8
Definition: c.h:263
unsigned int Oid
Definition: postgres_ext.h:31
struct xl_standby_locks xl_standby_locks
TransactionId xids[FLEXIBLE_ARRAY_MEMBER]
Definition: standbydefs.h:56
void standby_desc(StringInfo buf, XLogReaderState *record)
Definition: standbydesc.c:40
TransactionId latestCompletedXid
Definition: standbydefs.h:54
bool relcacheInitFileInval
Definition: standbydefs.h:67
static char * buf
Definition: pg_test_fsync.c:65
struct xl_invalidations xl_invalidations
void standby_redo(XLogReaderState *record)
Definition: standby.c:796
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: standbydefs.h:69
TransactionId nextXid
Definition: standbydefs.h:52
xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER]
Definition: standbydefs.h:41
void standby_desc_invalidations(StringInfo buf, int nmsgs, SharedInvalidationMessage *msgs, Oid dbId, Oid tsId, bool relcacheInitFileInval)
Definition: standbydesc.c:98
TransactionId oldestRunningXid
Definition: standbydefs.h:53
const char * standby_identify(uint8 info)
Definition: standbydesc.c:72
struct xl_running_xacts xl_running_xacts