PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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-2024, 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
18typedef struct xl_replorigin_set
19{
22 bool force;
24
25typedef 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 */
41extern RepOriginId replorigin_by_name(const char *roname, bool missing_ok);
42extern RepOriginId replorigin_create(const char *roname);
43extern void replorigin_drop_by_name(const char *name, bool missing_ok, bool nowait);
44extern bool replorigin_by_oid(RepOriginId roident, bool missing_ok,
45 char **roname);
46
47/* API for querying & manipulating replication progress tracking */
48extern void replorigin_advance(RepOriginId node,
49 XLogRecPtr remote_commit,
50 XLogRecPtr local_commit,
51 bool go_backward, bool wal_log);
52extern XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush);
53
54extern void replorigin_session_advance(XLogRecPtr remote_commit,
55 XLogRecPtr local_commit);
56extern void replorigin_session_setup(RepOriginId node, int acquired_by);
57extern void replorigin_session_reset(void);
59
60/* Checkpoint/Startup integration */
61extern void CheckPointReplicationOrigin(void);
62extern void StartupReplicationOrigin(void);
63
64/* WAL logging */
65extern void replorigin_redo(XLogReaderState *record);
66extern void replorigin_desc(StringInfo buf, XLogReaderState *record);
67extern const char *replorigin_identify(uint8 info);
68
69/* shared memory allocation */
71extern void ReplicationOriginShmemInit(void);
72
73#endif /* PG_ORIGIN_H */
#define PGDLLIMPORT
Definition: c.h:1274
uint8_t uint8
Definition: c.h:483
size_t Size
Definition: c.h:559
int64 TimestampTz
Definition: timestamp.h:39
RepOriginId replorigin_by_name(const char *roname, bool missing_ok)
Definition: origin.c:225
Size ReplicationOriginShmemSize(void)
Definition: origin.c:510
RepOriginId replorigin_create(const char *roname)
Definition: origin.c:256
void replorigin_session_reset(void)
Definition: origin.c:1194
void replorigin_session_advance(XLogRecPtr remote_commit, XLogRecPtr local_commit)
Definition: origin.c:1223
PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn
Definition: origin.c:160
bool replorigin_by_oid(RepOriginId roident, bool missing_ok, char **roname)
Definition: origin.c:469
void replorigin_desc(StringInfo buf, XLogReaderState *record)
XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush)
Definition: origin.c:1018
struct xl_replorigin_drop xl_replorigin_drop
const char * replorigin_identify(uint8 info)
void StartupReplicationOrigin(void)
Definition: origin.c:703
void replorigin_drop_by_name(const char *name, bool missing_ok, bool nowait)
Definition: origin.c:415
void replorigin_advance(RepOriginId node, XLogRecPtr remote_commit, XLogRecPtr local_commit, bool go_backward, bool wal_log)
Definition: origin.c:892
void replorigin_session_setup(RepOriginId node, int acquired_by)
Definition: origin.c:1101
void CheckPointReplicationOrigin(void)
Definition: origin.c:577
PGDLLIMPORT RepOriginId replorigin_session_origin
Definition: origin.c:159
XLogRecPtr replorigin_session_get_progress(bool flush)
Definition: origin.c:1241
void ReplicationOriginShmemInit(void)
Definition: origin.c:530
struct xl_replorigin_set xl_replorigin_set
PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp
Definition: origin.c:161
void replorigin_redo(XLogReaderState *record)
Definition: origin.c:831
static char * buf
Definition: pg_test_fsync.c:72
RepOriginId node_id
Definition: origin.h:27
RepOriginId node_id
Definition: origin.h:21
XLogRecPtr remote_lsn
Definition: origin.h:20
const char * name
uint16 RepOriginId
Definition: xlogdefs.h:65
uint64 XLogRecPtr
Definition: xlogdefs.h:21