Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c80b31d

Browse files
Refactor headers to split out standby defs
Jeff Janes
1 parent 978b2f6 commit c80b31d

File tree

4 files changed

+56
-37
lines changed

4 files changed

+56
-37
lines changed

src/backend/access/rmgrdesc/standbydesc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
#include "postgres.h"
1616

17-
#include "storage/standby.h"
17+
#include "storage/standbydefs.h"
1818

1919
static void
2020
standby_desc_running_xacts(StringInfo buf, xl_running_xacts *xlrec)

src/bin/pg_xlogdump/rmgrdesc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "commands/tablespace.h"
2828
#include "replication/origin.h"
2929
#include "rmgrdesc.h"
30-
#include "storage/standby.h"
30+
#include "storage/standbydefs.h"
3131
#include "utils/relmapper.h"
3232

3333
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup) \

src/include/storage/standby.h

+1-35
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
#ifndef STANDBY_H
1515
#define STANDBY_H
1616

17-
#include "access/xlogreader.h"
18-
#include "lib/stringinfo.h"
19-
#include "storage/lockdefs.h"
17+
#include "storage/standbydefs.h"
2018
#include "storage/procsignal.h"
2119
#include "storage/relfilenode.h"
2220

@@ -51,41 +49,9 @@ extern void StandbyReleaseLockTree(TransactionId xid,
5149
extern void StandbyReleaseAllLocks(void);
5250
extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids);
5351

54-
/*
55-
* XLOG message types
56-
*/
57-
#define XLOG_STANDBY_LOCK 0x00
58-
#define XLOG_RUNNING_XACTS 0x10
59-
60-
typedef struct xl_standby_locks
61-
{
62-
int nlocks; /* number of entries in locks array */
63-
xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER];
64-
} xl_standby_locks;
65-
66-
/*
67-
* When we write running xact data to WAL, we use this structure.
68-
*/
69-
typedef struct xl_running_xacts
70-
{
71-
int xcnt; /* # of xact ids in xids[] */
72-
int subxcnt; /* # of subxact ids in xids[] */
73-
bool subxid_overflow; /* snapshot overflowed, subxids missing */
74-
TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */
75-
TransactionId oldestRunningXid; /* *not* oldestXmin */
76-
TransactionId latestCompletedXid; /* so we can set xmax */
77-
78-
TransactionId xids[FLEXIBLE_ARRAY_MEMBER];
79-
} xl_running_xacts;
80-
8152
#define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids)
8253

8354

84-
/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
85-
extern void standby_redo(XLogReaderState *record);
86-
extern void standby_desc(StringInfo buf, XLogReaderState *record);
87-
extern const char *standby_identify(uint8 info);
88-
8955
/*
9056
* Declarations for GetRunningTransactionData(). Similar to Snapshots, but
9157
* not quite. This has nothing at all to do with visibility on this server,

src/include/storage/standbydefs.h

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* standbydef.h
4+
* Frontend exposed definitions for hot standby mode.
5+
*
6+
*
7+
* Portions Copyright (c) 1996-2015, 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+
21+
/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
22+
extern void standby_redo(XLogReaderState *record);
23+
extern void standby_desc(StringInfo buf, XLogReaderState *record);
24+
extern const char *standby_identify(uint8 info);
25+
26+
/*
27+
* XLOG message types
28+
*/
29+
#define XLOG_STANDBY_LOCK 0x00
30+
#define XLOG_RUNNING_XACTS 0x10
31+
32+
typedef struct xl_standby_locks
33+
{
34+
int nlocks; /* number of entries in locks array */
35+
xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER];
36+
} xl_standby_locks;
37+
38+
/*
39+
* When we write running xact data to WAL, we use this structure.
40+
*/
41+
typedef struct xl_running_xacts
42+
{
43+
int xcnt; /* # of xact ids in xids[] */
44+
int subxcnt; /* # of subxact ids in xids[] */
45+
bool subxid_overflow; /* snapshot overflowed, subxids missing */
46+
TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */
47+
TransactionId oldestRunningXid; /* *not* oldestXmin */
48+
TransactionId latestCompletedXid; /* so we can set xmax */
49+
50+
TransactionId xids[FLEXIBLE_ARRAY_MEMBER];
51+
} xl_running_xacts;
52+
53+
#endif /* STANDBYDEFS_H */

0 commit comments

Comments
 (0)