PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
origin.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  * origin.h
3  * Exports from replication/logical/origin.c
4  *
5  * Copyright (c) 2013-2017, PostgreSQL Global Development Group
6  *
7  * src/include/replication/origin.h
8  *-------------------------------------------------------------------------
9  */
10 #ifndef PG_ORIGIN_H
11 #define PG_ORIGIN_H
12 
13 #include "fmgr.h"
14 #include "access/xlog.h"
15 #include "access/xlogdefs.h"
16 #include "access/xlogreader.h"
18 
19 typedef struct xl_replorigin_set
20 {
23  bool force;
25 
26 typedef struct xl_replorigin_drop
27 {
30 
31 #define XLOG_REPLORIGIN_SET 0x00
32 #define XLOG_REPLORIGIN_DROP 0x10
33 
34 #define InvalidRepOriginId 0
35 #define DoNotReplicateId PG_UINT16_MAX
36 
40 
41 /* API for querying & manipulating replication origins */
42 extern RepOriginId replorigin_by_name(char *name, bool missing_ok);
43 extern RepOriginId replorigin_create(char *name);
44 extern void replorigin_drop(RepOriginId roident, bool nowait);
45 extern bool replorigin_by_oid(RepOriginId roident, bool missing_ok,
46  char **roname);
47 
48 /* API for querying & manipulating replication progress tracking */
49 extern void replorigin_advance(RepOriginId node,
50  XLogRecPtr remote_commit,
51  XLogRecPtr local_commit,
52  bool go_backward, bool wal_log);
53 extern XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush);
54 
55 extern void replorigin_session_advance(XLogRecPtr remote_commit,
56  XLogRecPtr local_commit);
57 extern void replorigin_session_setup(RepOriginId node);
58 extern void replorigin_session_reset(void);
60 
61 /* Checkpoint/Startup integration */
62 extern void CheckPointReplicationOrigin(void);
63 extern void StartupReplicationOrigin(void);
64 
65 /* WAL logging */
66 void replorigin_redo(XLogReaderState *record);
68 const char *replorigin_identify(uint8 info);
69 
70 /* shared memory allocation */
71 extern Size ReplicationOriginShmemSize(void);
72 extern void ReplicationOriginShmemInit(void);
73 
74 #endif /* PG_ORIGIN_H */
const char * replorigin_identify(uint8 info)
int64 TimestampTz
Definition: timestamp.h:39
Size ReplicationOriginShmemSize(void)
Definition: origin.c:458
unsigned char uint8
Definition: c.h:256
uint16 RepOriginId
Definition: xlogdefs.h:51
void CheckPointReplicationOrigin(void)
Definition: origin.c:528
#define PGDLLIMPORT
Definition: c.h:1069
XLogRecPtr replorigin_session_get_progress(bool flush)
Definition: origin.c:1148
struct xl_replorigin_drop xl_replorigin_drop
static char * buf
Definition: pg_test_fsync.c:67
void replorigin_drop(RepOriginId roident, bool nowait)
Definition: origin.c:334
PGDLLIMPORT RepOriginId replorigin_session_origin
Definition: origin.c:155
void ReplicationOriginShmemInit(void)
Definition: origin.c:478
bool replorigin_by_oid(RepOriginId roident, bool missing_ok, char **roname)
Definition: origin.c:417
RepOriginId replorigin_create(char *name)
Definition: origin.c:242
PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp
Definition: origin.c:157
void replorigin_desc(StringInfo buf, XLogReaderState *record)
RepOriginId node_id
Definition: origin.h:28
uint64 XLogRecPtr
Definition: xlogdefs.h:21
void replorigin_session_reset(void)
Definition: origin.c:1101
RepOriginId node_id
Definition: origin.h:22
size_t Size
Definition: c.h:350
void replorigin_advance(RepOriginId node, XLogRecPtr remote_commit, XLogRecPtr local_commit, bool go_backward, bool wal_log)
Definition: origin.c:817
XLogRecPtr remote_lsn
Definition: origin.h:21
const char * name
Definition: encode.c:521
void replorigin_session_advance(XLogRecPtr remote_commit, XLogRecPtr local_commit)
Definition: origin.c:1130
RepOriginId replorigin_by_name(char *name, bool missing_ok)
Definition: origin.c:211
PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn
Definition: origin.c:156
void replorigin_redo(XLogReaderState *record)
Definition: origin.c:756
XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush)
Definition: origin.c:940
void replorigin_session_setup(RepOriginId node)
Definition: origin.c:1013
struct xl_replorigin_set xl_replorigin_set
void StartupReplicationOrigin(void)
Definition: origin.c:641