mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Refactor headers to split out standby defs
Jeff Janes
This commit is contained in:
parent
978b2f65aa
commit
c80b31d557
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "storage/standby.h"
|
#include "storage/standbydefs.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
standby_desc_running_xacts(StringInfo buf, xl_running_xacts *xlrec)
|
standby_desc_running_xacts(StringInfo buf, xl_running_xacts *xlrec)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "commands/tablespace.h"
|
#include "commands/tablespace.h"
|
||||||
#include "replication/origin.h"
|
#include "replication/origin.h"
|
||||||
#include "rmgrdesc.h"
|
#include "rmgrdesc.h"
|
||||||
#include "storage/standby.h"
|
#include "storage/standbydefs.h"
|
||||||
#include "utils/relmapper.h"
|
#include "utils/relmapper.h"
|
||||||
|
|
||||||
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup) \
|
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup) \
|
||||||
|
@ -14,9 +14,7 @@
|
|||||||
#ifndef STANDBY_H
|
#ifndef STANDBY_H
|
||||||
#define STANDBY_H
|
#define STANDBY_H
|
||||||
|
|
||||||
#include "access/xlogreader.h"
|
#include "storage/standbydefs.h"
|
||||||
#include "lib/stringinfo.h"
|
|
||||||
#include "storage/lockdefs.h"
|
|
||||||
#include "storage/procsignal.h"
|
#include "storage/procsignal.h"
|
||||||
#include "storage/relfilenode.h"
|
#include "storage/relfilenode.h"
|
||||||
|
|
||||||
@ -51,41 +49,9 @@ extern void StandbyReleaseLockTree(TransactionId xid,
|
|||||||
extern void StandbyReleaseAllLocks(void);
|
extern void StandbyReleaseAllLocks(void);
|
||||||
extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids);
|
extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids);
|
||||||
|
|
||||||
/*
|
|
||||||
* XLOG message types
|
|
||||||
*/
|
|
||||||
#define XLOG_STANDBY_LOCK 0x00
|
|
||||||
#define XLOG_RUNNING_XACTS 0x10
|
|
||||||
|
|
||||||
typedef struct xl_standby_locks
|
|
||||||
{
|
|
||||||
int nlocks; /* number of entries in locks array */
|
|
||||||
xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER];
|
|
||||||
} xl_standby_locks;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When we write running xact data to WAL, we use this structure.
|
|
||||||
*/
|
|
||||||
typedef struct xl_running_xacts
|
|
||||||
{
|
|
||||||
int xcnt; /* # of xact ids in xids[] */
|
|
||||||
int subxcnt; /* # of subxact ids in xids[] */
|
|
||||||
bool subxid_overflow; /* snapshot overflowed, subxids missing */
|
|
||||||
TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */
|
|
||||||
TransactionId oldestRunningXid; /* *not* oldestXmin */
|
|
||||||
TransactionId latestCompletedXid; /* so we can set xmax */
|
|
||||||
|
|
||||||
TransactionId xids[FLEXIBLE_ARRAY_MEMBER];
|
|
||||||
} xl_running_xacts;
|
|
||||||
|
|
||||||
#define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids)
|
#define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids)
|
||||||
|
|
||||||
|
|
||||||
/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
|
|
||||||
extern void standby_redo(XLogReaderState *record);
|
|
||||||
extern void standby_desc(StringInfo buf, XLogReaderState *record);
|
|
||||||
extern const char *standby_identify(uint8 info);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Declarations for GetRunningTransactionData(). Similar to Snapshots, but
|
* Declarations for GetRunningTransactionData(). Similar to Snapshots, but
|
||||||
* not quite. This has nothing at all to do with visibility on this server,
|
* not quite. This has nothing at all to do with visibility on this server,
|
||||||
|
53
src/include/storage/standbydefs.h
Normal file
53
src/include/storage/standbydefs.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* standbydef.h
|
||||||
|
* Frontend exposed definitions for hot standby mode.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
||||||
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
|
*
|
||||||
|
* src/include/storage/standbydefs.h
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#ifndef STANDBYDEFS_H
|
||||||
|
#define STANDBYDEFS_H
|
||||||
|
|
||||||
|
#include "access/xlogreader.h"
|
||||||
|
#include "lib/stringinfo.h"
|
||||||
|
#include "storage/lockdefs.h"
|
||||||
|
|
||||||
|
/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */
|
||||||
|
extern void standby_redo(XLogReaderState *record);
|
||||||
|
extern void standby_desc(StringInfo buf, XLogReaderState *record);
|
||||||
|
extern const char *standby_identify(uint8 info);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XLOG message types
|
||||||
|
*/
|
||||||
|
#define XLOG_STANDBY_LOCK 0x00
|
||||||
|
#define XLOG_RUNNING_XACTS 0x10
|
||||||
|
|
||||||
|
typedef struct xl_standby_locks
|
||||||
|
{
|
||||||
|
int nlocks; /* number of entries in locks array */
|
||||||
|
xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER];
|
||||||
|
} xl_standby_locks;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When we write running xact data to WAL, we use this structure.
|
||||||
|
*/
|
||||||
|
typedef struct xl_running_xacts
|
||||||
|
{
|
||||||
|
int xcnt; /* # of xact ids in xids[] */
|
||||||
|
int subxcnt; /* # of subxact ids in xids[] */
|
||||||
|
bool subxid_overflow; /* snapshot overflowed, subxids missing */
|
||||||
|
TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */
|
||||||
|
TransactionId oldestRunningXid; /* *not* oldestXmin */
|
||||||
|
TransactionId latestCompletedXid; /* so we can set xmax */
|
||||||
|
|
||||||
|
TransactionId xids[FLEXIBLE_ARRAY_MEMBER];
|
||||||
|
} xl_running_xacts;
|
||||||
|
|
||||||
|
#endif /* STANDBYDEFS_H */
|
Loading…
x
Reference in New Issue
Block a user