PostgreSQL Source Code  git master
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-2019, 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 "access/xlog.h"
14 #include "access/xlogdefs.h"
15 #include "access/xlogreader.h"
17 
18 typedef struct xl_replorigin_set
19 {
22  bool force;
24 
25 typedef struct xl_replorigin_drop
26 {
29 
30 #define XLOG_REPLORIGIN_SET 0x00
31 #define XLOG_REPLORIGIN_DROP 0x10
32 
33 #define InvalidRepOriginId 0
34 #define DoNotReplicateId PG_UINT16_MAX
35 
39 
40 /* API for querying & manipulating replication origins */
41 extern RepOriginId replorigin_by_name(char *name, bool missing_ok);
42 extern RepOriginId replorigin_create(char *name);
43 extern void replorigin_drop(RepOriginId roident, bool nowait);
44 extern bool replorigin_by_oid(RepOriginId roident, bool missing_ok,
45  char **roname);
46 
47 /* API for querying & manipulating replication progress tracking */
48 extern void replorigin_advance(RepOriginId node,
49  XLogRecPtr remote_commit,
50  XLogRecPtr local_commit,
51  bool go_backward, bool wal_log);
52 extern XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush);
53 
54 extern void replorigin_session_advance(XLogRecPtr remote_commit,
55  XLogRecPtr local_commit);
56 extern void replorigin_session_setup(RepOriginId node);
57 extern void replorigin_session_reset(void);
59 
60 /* Checkpoint/Startup integration */
61 extern void CheckPointReplicationOrigin(void);
62 extern void StartupReplicationOrigin(void);
63 
64 /* WAL logging */
65 void replorigin_redo(XLogReaderState *record);
67 const char *replorigin_identify(uint8 info);
68 
69 /* shared memory allocation */
70 extern Size ReplicationOriginShmemSize(void);
71 extern void ReplicationOriginShmemInit(void);
72 
73 #endif /* PG_ORIGIN_H */
const char * replorigin_identify(uint8 info)
int64 TimestampTz
Definition: timestamp.h:39
Size ReplicationOriginShmemSize(void)
Definition: origin.c:476
unsigned char uint8
Definition: c.h:356
uint16 RepOriginId
Definition: xlogdefs.h:58
void CheckPointReplicationOrigin(void)
Definition: origin.c:546
#define PGDLLIMPORT
Definition: c.h:1243
XLogRecPtr replorigin_session_get_progress(bool flush)
Definition: origin.c:1192
struct xl_replorigin_drop xl_replorigin_drop
static char * buf
Definition: pg_test_fsync.c:68
void replorigin_drop(RepOriginId roident, bool nowait)
Definition: origin.c:335
PGDLLIMPORT RepOriginId replorigin_session_origin
Definition: origin.c:156
void ReplicationOriginShmemInit(void)
Definition: origin.c:496
bool replorigin_by_oid(RepOriginId roident, bool missing_ok, char **roname)
Definition: origin.c:435
RepOriginId replorigin_create(char *name)
Definition: origin.c:243
PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp
Definition: origin.c:158
void replorigin_desc(StringInfo buf, XLogReaderState *record)
RepOriginId node_id
Definition: origin.h:27
uint64 XLogRecPtr
Definition: xlogdefs.h:21
void replorigin_session_reset(void)
Definition: origin.c:1145
RepOriginId node_id
Definition: origin.h:21
size_t Size
Definition: c.h:466
void replorigin_advance(RepOriginId node, XLogRecPtr remote_commit, XLogRecPtr local_commit, bool go_backward, bool wal_log)
Definition: origin.c:861
XLogRecPtr remote_lsn
Definition: origin.h:20
const char * name
Definition: encode.c:521
void replorigin_session_advance(XLogRecPtr remote_commit, XLogRecPtr local_commit)
Definition: origin.c:1174
RepOriginId replorigin_by_name(char *name, bool missing_ok)
Definition: origin.c:212
PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn
Definition: origin.c:157
void replorigin_redo(XLogReaderState *record)
Definition: origin.c:800
XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush)
Definition: origin.c:984
void replorigin_session_setup(RepOriginId node)
Definition: origin.c:1057
struct xl_replorigin_set xl_replorigin_set
void StartupReplicationOrigin(void)
Definition: origin.c:672