forked from 2ndQuadrant/pglogical
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pglogical_repset.h
90 lines (73 loc) · 2.99 KB
/
pglogical_repset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*-------------------------------------------------------------------------
*
* pglogical_repset.h
* pglogical replication set manipulation functions
*
* Copyright (c) 2015, PostgreSQL Global Development Group
*
* IDENTIFICATION
* pglogical_repset.h
*
*-------------------------------------------------------------------------
*/
#ifndef PGLOGICAL_REPSET_H
#define PGLOGICAL_REPSET_H
#include "replication/reorderbuffer.h"
typedef struct PGLogicalRepSet
{
Oid id;
Oid nodeid;
char *name;
bool replicate_insert;
bool replicate_update;
bool replicate_delete;
bool replicate_truncate;
} PGLogicalRepSet;
#define DEFAULT_REPSET_NAME "default"
#define DEFAULT_INSONLY_REPSET_NAME "default_insert_only"
#define DDL_SQL_REPSET_NAME "ddl_sql"
/* This is only valid within one output plugin instance/walsender. */
typedef struct PGLogicalTableRepInfo
{
Oid reloid; /* key */
bool isvalid; /* is this entry valid? */
bool replicate_insert; /* should insert be replicated? */
bool replicate_update; /* should update be replicated? */
bool replicate_delete; /* should delete be replicated? */
Bitmapset *att_list; /* column filter
NULL if everything is replicated
otherwise each replicated column
is a member */
List *row_filter; /* compiled row_filter nodes */
} PGLogicalTableRepInfo;
extern PGLogicalRepSet *get_replication_set(Oid setid);
extern PGLogicalRepSet *get_replication_set_by_name(Oid nodeid,
const char *setname,
bool missing_ok);
extern List *get_node_replication_sets(Oid nodeid);
extern List *get_replication_sets(Oid nodeid, List *replication_set_names,
bool missing_ok);
extern PGLogicalTableRepInfo *get_table_replication_info(Oid nodeid,
Relation table, List *subs_replication_sets);
extern void create_replication_set(PGLogicalRepSet *repset);
extern void alter_replication_set(PGLogicalRepSet *repset);
extern void drop_replication_set(Oid setid);
extern void drop_node_replication_sets(Oid nodeid);
extern void replication_set_add_table(Oid setid, Oid reloid,
List *att_list, Node *row_filter);
extern void replication_set_add_seq(Oid setid, Oid seqoid);
extern List *replication_set_get_tables(Oid setid);
extern List *replication_set_get_seqs(Oid setid);
extern PGDLLEXPORT void replication_set_remove_table(Oid setid, Oid reloid,
bool from_drop);
extern PGDLLEXPORT void replication_set_remove_seq(Oid setid, Oid reloid,
bool from_drop);
extern List *get_table_replication_sets(Oid nodeid, Oid reloid);
extern List *get_seq_replication_sets(Oid nodeid, Oid seqoid);
extern PGLogicalRepSet *replication_set_from_tuple(HeapTuple tuple);
extern Oid get_replication_set_rel_oid(void);
extern Oid get_replication_set_table_rel_oid(void);
extern Oid get_replication_set_seq_rel_oid(void);
extern char *stringlist_to_identifierstr(List *repsets);
extern int get_att_num_by_name(TupleDesc desc, const char *attname);
#endif /* PGLOGICAL_REPSET_H */