summaryrefslogtreecommitdiff
path: root/src/repmgr/repmgr.msg
blob: ba54493684513ab16bc5b5bf26859b228621b450 (plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
PREFIX	__repmgr

INCLUDE #include "db_int.h"
INCLUDE #include "dbinc/db_swap.h"
INCLUDE

BEGIN_MSG handshake
ARG	port		u_int16_t
ARG	alignment	u_int16_t
ARG	ack_policy	u_int32_t
ARG	flags		u_int32_t
END

BEGIN_MSG v3handshake
ARG	port		u_int16_t
ARG	priority	u_int32_t
ARG	flags		u_int32_t
END

BEGIN_MSG v2handshake
ARG	port		u_int16_t
ARG	priority	u_int32_t
END

BEGIN_MSG parm_refresh
ARG	ack_policy	u_int32_t
ARG	flags		u_int32_t
END

BEGIN_MSG permlsn
ARG	generation	u_int32_t
ARG	lsn		DB_LSN
END

BEGIN_MSG version_proposal
ARG	min		u_int32_t
ARG	max		u_int32_t
END

BEGIN_MSG version_confirmation
ARG	version		u_int32_t
END

BEGIN_MSG msg_hdr
ARG	type		u_int8_t
ARG	word1		u_int32_t
ARG	word2		u_int32_t
END

/* Metadata that goes along with user message on a DB_CHANNEL. */
BEGIN_MSG msg_metadata
ARG	tag		u_int32_t
ARG	limit		u_int32_t
ARG	flags		u_int32_t
END

/*
 * The membership database has a record for each site in the group, plus one
 * extra meta-data record.  The key of the meta-data record has a zero-length
 * host, and a port value of 0.
 */
BEGIN_MSG membership_key check_length
ARG	host		DBT
ARG	port		u_int16_t
END

BEGIN_MSG membership_data
ARG	status          u_int32_t
ARG	flags           u_int32_t
END

BEGIN_MSG v4membership_data
ARG	flags           u_int32_t
END

/*
 * The "format" identifies the content and layout of the records within the
 * membership database (i.e., some of the items defined here in this *.msg
 * file).  It should be incremented when the layouts change in future Berkeley
 * DB releases.  The "version" counts group changes that the application makes
 * by adding or removing sites; thus it varies dynamically thoughout the life of
 * a group, during a single release of Berkeley DB.
 */ 
BEGIN_MSG member_metadata
ARG	format		u_int32_t
ARG	version		u_int32_t
END

/*
 * When a new site wants to join a group, it "guesses" that the configured
 * "helper" site is the master, and sends the request there.  When that guess
 * is wrong, the helper site responds with the location of the current master,
 * in effect "forwarding" the request.
 */
BEGIN_MSG gm_fwd check_length
ARG	host		DBT
ARG	port		u_int16_t
ARG	gen		u_int32_t
END

/* Membership list version header: */
BEGIN_MSG membr_vers
ARG	version		u_int32_t
ARG	gen		u_int32_t
END

BEGIN_MSG site_info check_length
ARG	host		DBT
ARG	port		u_int16_t
ARG	status		u_int32_t
ARG	flags		u_int32_t
END

BEGIN_MSG v4site_info check_length
ARG	host		DBT
ARG	port		u_int16_t
ARG	flags		u_int32_t
END

/*
 * If site A breaks or rejects a connection from site B, it first
 * tries to send B this message containing site A's currently known
 * membership DB version and site B's status in site A's membership DB.
 * Site B can use them to decide what to do.  If site B knows of a later
 * version, it should retry the connection to site A later, polling
 * until site A catches up.  However, if site B's known version is
 * less and site B's status is adding in site A's membership DB, it
 * means that a badly-timed change of master may have caused the current
 * master to lose B's membership DB update to present, so it should
 * retry the connection to site A later, otherwise, site B is no longer
 * in the group and it should shut down and notify the application.
 */
BEGIN_MSG connect_reject
ARG	version		u_int32_t
ARG	gen		u_int32_t
ARG	status		u_int32_t
END

BEGIN_MSG v4connect_reject
ARG	version		u_int32_t
ARG	gen		u_int32_t
END

/*
 * For preferred master LSN history comparison between the sites.
 * The next_gen_lsn is [0,0] if the next generation doesn't yet exist.
 */
BEGIN_MSG lsnhist_match
ARG	lsn		DB_LSN
ARG	hist_sec	u_int32_t
ARG	hist_nsec	u_int32_t
ARG	next_gen_lsn	DB_LSN
END