1 | /*
|
---|
2 | CTDB protocol marshalling
|
---|
3 |
|
---|
4 | Copyright (C) Amitay Isaacs 2015
|
---|
5 |
|
---|
6 | This program is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 3 of the License, or
|
---|
9 | (at your option) any later version.
|
---|
10 |
|
---|
11 | This program is distributed in the hope that it will be useful,
|
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | GNU General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef __CTDB_PROTOCOL_H__
|
---|
21 | #define __CTDB_PROTOCOL_H__
|
---|
22 |
|
---|
23 | #include <tdb.h>
|
---|
24 |
|
---|
25 | #define CTDB_MAGIC 0x43544442 /* CTDB */
|
---|
26 | #define CTDB_PROTOCOL 1
|
---|
27 |
|
---|
28 | enum ctdb_operation {
|
---|
29 | CTDB_REQ_CALL = 0,
|
---|
30 | CTDB_REPLY_CALL = 1,
|
---|
31 | CTDB_REQ_DMASTER = 2,
|
---|
32 | CTDB_REPLY_DMASTER = 3,
|
---|
33 | CTDB_REPLY_ERROR = 4,
|
---|
34 | CTDB_REQ_MESSAGE = 5,
|
---|
35 | /* #6 removed */
|
---|
36 | CTDB_REQ_CONTROL = 7,
|
---|
37 | CTDB_REPLY_CONTROL = 8,
|
---|
38 | CTDB_REQ_KEEPALIVE = 9,
|
---|
39 | };
|
---|
40 |
|
---|
41 | /* used on the domain socket, send a pdu to the local daemon */
|
---|
42 | #define CTDB_CURRENT_NODE 0xF0000001
|
---|
43 | /* send a broadcast to all nodes in the cluster, active or not */
|
---|
44 | #define CTDB_BROADCAST_ALL 0xF0000002
|
---|
45 | /* send a broadcast to all nodes in the current vnn map */
|
---|
46 | #define CTDB_BROADCAST_VNNMAP 0xF0000003
|
---|
47 | /* send a broadcast to all connected nodes */
|
---|
48 | #define CTDB_BROADCAST_CONNECTED 0xF0000004
|
---|
49 | /* send a broadcast to selected connected nodes */
|
---|
50 | #define CTDB_MULTICAST 0xF0000005
|
---|
51 |
|
---|
52 | #define CTDB_UNKNOWN_PNN 0xFFFFFFFF
|
---|
53 |
|
---|
54 | /* the key used to store persistent db sequence number */
|
---|
55 | #define CTDB_DB_SEQNUM_KEY "__db_sequence_number__"
|
---|
56 |
|
---|
57 | struct ctdb_req_header {
|
---|
58 | uint32_t length;
|
---|
59 | uint32_t ctdb_magic;
|
---|
60 | uint32_t ctdb_version;
|
---|
61 | uint32_t generation;
|
---|
62 | uint32_t operation;
|
---|
63 | uint32_t destnode;
|
---|
64 | uint32_t srcnode;
|
---|
65 | uint32_t reqid;
|
---|
66 | };
|
---|
67 |
|
---|
68 | struct ctdb_req_call {
|
---|
69 | uint32_t flags;
|
---|
70 | uint32_t db_id;
|
---|
71 | uint32_t callid;
|
---|
72 | uint32_t hopcount;
|
---|
73 | TDB_DATA key;
|
---|
74 | TDB_DATA calldata;
|
---|
75 | };
|
---|
76 |
|
---|
77 | struct ctdb_reply_call {
|
---|
78 | int32_t status;
|
---|
79 | TDB_DATA data;
|
---|
80 | };
|
---|
81 |
|
---|
82 | struct ctdb_reply_error {
|
---|
83 | int32_t status;
|
---|
84 | TDB_DATA msg;
|
---|
85 | };
|
---|
86 |
|
---|
87 | struct ctdb_req_dmaster {
|
---|
88 | uint32_t db_id;
|
---|
89 | uint64_t rsn;
|
---|
90 | uint32_t dmaster;
|
---|
91 | TDB_DATA key;
|
---|
92 | TDB_DATA data;
|
---|
93 | };
|
---|
94 |
|
---|
95 | struct ctdb_reply_dmaster {
|
---|
96 | uint32_t db_id;
|
---|
97 | uint64_t rsn;
|
---|
98 | TDB_DATA key;
|
---|
99 | TDB_DATA data;
|
---|
100 | };
|
---|
101 |
|
---|
102 | #define CTDB_NULL_FUNC 0xFF000001
|
---|
103 | #define CTDB_FETCH_FUNC 0xFF000002
|
---|
104 | #define CTDB_FETCH_WITH_HEADER_FUNC 0xFF000003
|
---|
105 |
|
---|
106 | struct ctdb_call {
|
---|
107 | int call_id;
|
---|
108 | TDB_DATA key;
|
---|
109 | TDB_DATA call_data;
|
---|
110 | TDB_DATA reply_data;
|
---|
111 | uint32_t status;
|
---|
112 | #define CTDB_IMMEDIATE_MIGRATION 0x00000001
|
---|
113 | #define CTDB_CALL_FLAG_VACUUM_MIGRATION 0x00000002
|
---|
114 | #define CTDB_WANT_READONLY 0x00000004
|
---|
115 | uint32_t flags;
|
---|
116 | };
|
---|
117 |
|
---|
118 | /* SRVID to catch all messages */
|
---|
119 | #define CTDB_SRVID_ALL (~(uint64_t)0)
|
---|
120 |
|
---|
121 | /* SRVID prefix used by CTDB */
|
---|
122 | #define CTDB_SRVID_PREFIX 0xF000000000000000LL
|
---|
123 |
|
---|
124 | /* SRVID prefix used during recovery for pulling and pushing databases */
|
---|
125 | #define CTDB_SRVID_RECOVERY 0xF001000000000000LL
|
---|
126 |
|
---|
127 | /* SRVID to assign of banning credits */
|
---|
128 | #define CTDB_SRVID_BANNING 0xF002000000000000LL
|
---|
129 |
|
---|
130 | /* SRVID to inform of election data */
|
---|
131 | #define CTDB_SRVID_ELECTION 0xF100000000000000LL
|
---|
132 |
|
---|
133 | /* SRVID to inform clients that the cluster has been reconfigured */
|
---|
134 | #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
|
---|
135 |
|
---|
136 | /* SRVID to inform clients an IP address has been released */
|
---|
137 | #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
|
---|
138 |
|
---|
139 | /* SRVID to inform clients that an IP address has been taken over */
|
---|
140 | #define CTDB_SRVID_TAKE_IP 0xF301000000000000LL
|
---|
141 |
|
---|
142 | /* SRVID to inform recovery daemon of the node flags */
|
---|
143 | #define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
|
---|
144 |
|
---|
145 | /* SRVID to inform recovery daemon to update public ip assignment */
|
---|
146 | #define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
|
---|
147 |
|
---|
148 | /* SRVID to inform recovery daemon to migrate a set of records */
|
---|
149 | #define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
|
---|
150 |
|
---|
151 | /* SRVID to inform recovery daemon to detach a database */
|
---|
152 | #define CTDB_SRVID_DETACH_DATABASE 0xF701000000000000LL
|
---|
153 |
|
---|
154 | /* SRVID to inform recovery daemon to dump talloc memdump to the log */
|
---|
155 | #define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
|
---|
156 |
|
---|
157 | /* SRVID to inform recovery daemon to send logs */
|
---|
158 | #define CTDB_SRVID_GETLOG 0xF801000000000000LL
|
---|
159 |
|
---|
160 | /* SRVID to inform recovery daemon to clear logs */
|
---|
161 | #define CTDB_SRVID_CLEARLOG 0xF802000000000000LL
|
---|
162 |
|
---|
163 | /* SRVID to inform recovery daemon to push the node flags to other nodes */
|
---|
164 | #define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
|
---|
165 |
|
---|
166 | /* SRVID to inform recovery daemon to reload the nodes file */
|
---|
167 | #define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
|
---|
168 |
|
---|
169 | /* SRVID to inform recovery daemon to perform a takeover run */
|
---|
170 | #define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
|
---|
171 |
|
---|
172 | /* SRVID to inform recovery daemon to rebalance ips for a node. */
|
---|
173 | #define CTDB_SRVID_REBALANCE_NODE 0xFB01000000000000LL
|
---|
174 |
|
---|
175 | /* SRVID to inform recovery daemon to stop takeover runs from occurring */
|
---|
176 | #define CTDB_SRVID_DISABLE_TAKEOVER_RUNS 0xFB03000000000000LL
|
---|
177 |
|
---|
178 | /* SRVID to inform recovery daemon to stop recoveries from occurring */
|
---|
179 | #define CTDB_SRVID_DISABLE_RECOVERIES 0xFB04000000000000LL
|
---|
180 |
|
---|
181 | /* SRVID to inform recovery daemon to disable the public ip checks */
|
---|
182 | #define CTDB_SRVID_DISABLE_IP_CHECK 0xFC00000000000000LL
|
---|
183 |
|
---|
184 | /* SRVID to inform recovery daemon of ipreallocate resposnes from ctdbd */
|
---|
185 | #define CTDB_SRVID_TAKEOVER_RUN_RESPONSE 0xFD00000000000000LL
|
---|
186 |
|
---|
187 | /* A range of ports reserved for registering a PID (top 8 bits)
|
---|
188 | * All ports matching the 8 top bits are reserved for exclusive use by
|
---|
189 | * registering a SRVID that matches the process-id of the requesting process
|
---|
190 | */
|
---|
191 | #define CTDB_SRVID_PID_RANGE 0x0000000000000000LL
|
---|
192 |
|
---|
193 | /* A range of ports reserved for samba (top 8 bits)
|
---|
194 | * All ports matching the 8 top bits are reserved for exclusive use by
|
---|
195 | * CIFS server
|
---|
196 | */
|
---|
197 | #define CTDB_SRVID_SAMBA_NOTIFY 0xFE00000000000000LL
|
---|
198 | #define CTDB_SRVID_SAMBA_RANGE 0xFE00000000000000LL
|
---|
199 |
|
---|
200 | /* A range of ports reserved for a CTDB NFS server (top 8 bits)
|
---|
201 | * All ports matching the 8 top bits are reserved for exclusive use by
|
---|
202 | * NFS server
|
---|
203 | */
|
---|
204 | #define CTDB_SRVID_NFSD_RANGE 0xEE00000000000000LL
|
---|
205 |
|
---|
206 | /* A range of ports reserved for a CTDB ISCSI server (top 8 bits)
|
---|
207 | * All ports matching the 8 top bits are reserved for exclusive use by
|
---|
208 | * ISCSI server
|
---|
209 | */
|
---|
210 | #define CTDB_SRVID_ISCSID_RANGE 0xDE00000000000000LL
|
---|
211 |
|
---|
212 | /* A range of ports reserved for testing (top 8 bits)
|
---|
213 | * All ports matching the 8 top bits are reserved for exclusive use by
|
---|
214 | * test applications
|
---|
215 | */
|
---|
216 | #define CTDB_SRVID_TEST_RANGE 0xCE00000000000000LL
|
---|
217 |
|
---|
218 | /* Range of ports reserved for traversals */
|
---|
219 | #define CTDB_SRVID_TRAVERSE_RANGE 0xBE00000000000000LL
|
---|
220 |
|
---|
221 |
|
---|
222 | enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
|
---|
223 | CTDB_CONTROL_STATISTICS = 1,
|
---|
224 | /* #2 removed */
|
---|
225 | CTDB_CONTROL_PING = 3,
|
---|
226 | CTDB_CONTROL_GETDBPATH = 4,
|
---|
227 | CTDB_CONTROL_GETVNNMAP = 5,
|
---|
228 | CTDB_CONTROL_SETVNNMAP = 6,
|
---|
229 | CTDB_CONTROL_GET_DEBUG = 7,
|
---|
230 | CTDB_CONTROL_SET_DEBUG = 8,
|
---|
231 | CTDB_CONTROL_GET_DBMAP = 9,
|
---|
232 | CTDB_CONTROL_GET_NODEMAPv4 = 10, /* obsolete */
|
---|
233 | CTDB_CONTROL_SET_DMASTER = 11, /* obsolete */
|
---|
234 | /* #12 removed */
|
---|
235 | CTDB_CONTROL_PULL_DB = 13,
|
---|
236 | CTDB_CONTROL_PUSH_DB = 14,
|
---|
237 | CTDB_CONTROL_GET_RECMODE = 15,
|
---|
238 | CTDB_CONTROL_SET_RECMODE = 16,
|
---|
239 | CTDB_CONTROL_STATISTICS_RESET = 17,
|
---|
240 | CTDB_CONTROL_DB_ATTACH = 18,
|
---|
241 | CTDB_CONTROL_SET_CALL = 19, /* obsolete */
|
---|
242 | CTDB_CONTROL_TRAVERSE_START = 20,
|
---|
243 | CTDB_CONTROL_TRAVERSE_ALL = 21,
|
---|
244 | CTDB_CONTROL_TRAVERSE_DATA = 22,
|
---|
245 | CTDB_CONTROL_REGISTER_SRVID = 23,
|
---|
246 | CTDB_CONTROL_DEREGISTER_SRVID = 24,
|
---|
247 | CTDB_CONTROL_GET_DBNAME = 25,
|
---|
248 | CTDB_CONTROL_ENABLE_SEQNUM = 26,
|
---|
249 | CTDB_CONTROL_UPDATE_SEQNUM = 27,
|
---|
250 | /* #28 removed */
|
---|
251 | CTDB_CONTROL_DUMP_MEMORY = 29,
|
---|
252 | CTDB_CONTROL_GET_PID = 30,
|
---|
253 | CTDB_CONTROL_GET_RECMASTER = 31,
|
---|
254 | CTDB_CONTROL_SET_RECMASTER = 32,
|
---|
255 | CTDB_CONTROL_FREEZE = 33,
|
---|
256 | CTDB_CONTROL_THAW = 34,
|
---|
257 | CTDB_CONTROL_GET_PNN = 35,
|
---|
258 | CTDB_CONTROL_SHUTDOWN = 36,
|
---|
259 | CTDB_CONTROL_GET_MONMODE = 37,
|
---|
260 | /* #38 removed */
|
---|
261 | /* #39 removed */
|
---|
262 | /* #40 removed */
|
---|
263 | /* #41 removed */
|
---|
264 | CTDB_CONTROL_TAKEOVER_IPv4 = 42, /* obsolete */
|
---|
265 | CTDB_CONTROL_RELEASE_IPv4 = 43, /* obsolete */
|
---|
266 | CTDB_CONTROL_TCP_CLIENT = 44,
|
---|
267 | CTDB_CONTROL_TCP_ADD = 45,
|
---|
268 | CTDB_CONTROL_TCP_REMOVE = 46,
|
---|
269 | CTDB_CONTROL_STARTUP = 47,
|
---|
270 | CTDB_CONTROL_SET_TUNABLE = 48,
|
---|
271 | CTDB_CONTROL_GET_TUNABLE = 49,
|
---|
272 | CTDB_CONTROL_LIST_TUNABLES = 50,
|
---|
273 | CTDB_CONTROL_GET_PUBLIC_IPSv4 = 51, /* obsolete */
|
---|
274 | CTDB_CONTROL_MODIFY_FLAGS = 52,
|
---|
275 | CTDB_CONTROL_GET_ALL_TUNABLES = 53,
|
---|
276 | CTDB_CONTROL_KILL_TCP = 54,
|
---|
277 | CTDB_CONTROL_GET_TCP_TICKLE_LIST = 55,
|
---|
278 | CTDB_CONTROL_SET_TCP_TICKLE_LIST = 56,
|
---|
279 | CTDB_CONTROL_REGISTER_SERVER_ID = 57,
|
---|
280 | CTDB_CONTROL_UNREGISTER_SERVER_ID = 58,
|
---|
281 | CTDB_CONTROL_CHECK_SERVER_ID = 59,
|
---|
282 | CTDB_CONTROL_GET_SERVER_ID_LIST = 60,
|
---|
283 | CTDB_CONTROL_DB_ATTACH_PERSISTENT = 61,
|
---|
284 | CTDB_CONTROL_PERSISTENT_STORE = 62, /* obsolete */
|
---|
285 | CTDB_CONTROL_UPDATE_RECORD = 63,
|
---|
286 | CTDB_CONTROL_SEND_GRATUITOUS_ARP = 64,
|
---|
287 | CTDB_CONTROL_TRANSACTION_START = 65,
|
---|
288 | CTDB_CONTROL_TRANSACTION_COMMIT = 66,
|
---|
289 | CTDB_CONTROL_WIPE_DATABASE = 67,
|
---|
290 | /* #68 removed */
|
---|
291 | CTDB_CONTROL_UPTIME = 69,
|
---|
292 | CTDB_CONTROL_START_RECOVERY = 70,
|
---|
293 | CTDB_CONTROL_END_RECOVERY = 71,
|
---|
294 | CTDB_CONTROL_RELOAD_NODES_FILE = 72,
|
---|
295 | /* #73 removed */
|
---|
296 | CTDB_CONTROL_TRY_DELETE_RECORDS = 74,
|
---|
297 | CTDB_CONTROL_ENABLE_MONITOR = 75,
|
---|
298 | CTDB_CONTROL_DISABLE_MONITOR = 76,
|
---|
299 | CTDB_CONTROL_ADD_PUBLIC_IP = 77,
|
---|
300 | CTDB_CONTROL_DEL_PUBLIC_IP = 78,
|
---|
301 | CTDB_CONTROL_RUN_EVENTSCRIPTS = 79,
|
---|
302 | CTDB_CONTROL_GET_CAPABILITIES = 80,
|
---|
303 | CTDB_CONTROL_START_PERSISTENT_UPDATE = 81, /* obsolete */
|
---|
304 | CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE= 82, /* obsolete */
|
---|
305 | CTDB_CONTROL_TRANS2_COMMIT = 83, /* obsolete */
|
---|
306 | CTDB_CONTROL_TRANS2_FINISHED = 84, /* obsolete */
|
---|
307 | CTDB_CONTROL_TRANS2_ERROR = 85, /* obsolete */
|
---|
308 | CTDB_CONTROL_TRANS2_COMMIT_RETRY = 86, /* obsolete */
|
---|
309 | CTDB_CONTROL_RECD_PING = 87,
|
---|
310 | CTDB_CONTROL_RELEASE_IP = 88,
|
---|
311 | CTDB_CONTROL_TAKEOVER_IP = 89,
|
---|
312 | CTDB_CONTROL_GET_PUBLIC_IPS = 90,
|
---|
313 | CTDB_CONTROL_GET_NODEMAP = 91,
|
---|
314 | /* missing */
|
---|
315 | CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS = 96,
|
---|
316 | CTDB_CONTROL_TRAVERSE_KILL = 97,
|
---|
317 | CTDB_CONTROL_RECD_RECLOCK_LATENCY = 98,
|
---|
318 | CTDB_CONTROL_GET_RECLOCK_FILE = 99,
|
---|
319 | CTDB_CONTROL_SET_RECLOCK_FILE = 100,
|
---|
320 | CTDB_CONTROL_STOP_NODE = 101,
|
---|
321 | CTDB_CONTROL_CONTINUE_NODE = 102,
|
---|
322 | CTDB_CONTROL_SET_NATGWSTATE = 103,
|
---|
323 | CTDB_CONTROL_SET_LMASTERROLE = 104,
|
---|
324 | CTDB_CONTROL_SET_RECMASTERROLE = 105,
|
---|
325 | CTDB_CONTROL_ENABLE_SCRIPT = 107,
|
---|
326 | CTDB_CONTROL_DISABLE_SCRIPT = 108,
|
---|
327 | CTDB_CONTROL_SET_BAN_STATE = 109,
|
---|
328 | CTDB_CONTROL_GET_BAN_STATE = 110,
|
---|
329 | CTDB_CONTROL_SET_DB_PRIORITY = 111,
|
---|
330 | CTDB_CONTROL_GET_DB_PRIORITY = 112,
|
---|
331 | CTDB_CONTROL_TRANSACTION_CANCEL = 113,
|
---|
332 | CTDB_CONTROL_REGISTER_NOTIFY = 114,
|
---|
333 | CTDB_CONTROL_DEREGISTER_NOTIFY = 115,
|
---|
334 | CTDB_CONTROL_TRANS2_ACTIVE = 116, /* obsolete */
|
---|
335 | CTDB_CONTROL_GET_LOG = 117, /* obsolete */
|
---|
336 | CTDB_CONTROL_CLEAR_LOG = 118, /* obsolete */
|
---|
337 | CTDB_CONTROL_TRANS3_COMMIT = 119,
|
---|
338 | CTDB_CONTROL_GET_DB_SEQNUM = 120,
|
---|
339 | CTDB_CONTROL_DB_SET_HEALTHY = 121,
|
---|
340 | CTDB_CONTROL_DB_GET_HEALTH = 122,
|
---|
341 | CTDB_CONTROL_GET_PUBLIC_IP_INFO = 123,
|
---|
342 | CTDB_CONTROL_GET_IFACES = 124,
|
---|
343 | CTDB_CONTROL_SET_IFACE_LINK_STATE = 125,
|
---|
344 | CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE = 126,
|
---|
345 | CTDB_CONTROL_GET_STAT_HISTORY = 127,
|
---|
346 | CTDB_CONTROL_SCHEDULE_FOR_DELETION = 128,
|
---|
347 | CTDB_CONTROL_SET_DB_READONLY = 129,
|
---|
348 | CTDB_CONTROL_CHECK_SRVIDS = 130,
|
---|
349 | CTDB_CONTROL_TRAVERSE_START_EXT = 131,
|
---|
350 | CTDB_CONTROL_GET_DB_STATISTICS = 132,
|
---|
351 | CTDB_CONTROL_SET_DB_STICKY = 133,
|
---|
352 | CTDB_CONTROL_RELOAD_PUBLIC_IPS = 134,
|
---|
353 | CTDB_CONTROL_TRAVERSE_ALL_EXT = 135,
|
---|
354 | CTDB_CONTROL_RECEIVE_RECORDS = 136,
|
---|
355 | CTDB_CONTROL_IPREALLOCATED = 137,
|
---|
356 | CTDB_CONTROL_GET_RUNSTATE = 138,
|
---|
357 | CTDB_CONTROL_DB_DETACH = 139,
|
---|
358 | CTDB_CONTROL_GET_NODES_FILE = 140,
|
---|
359 | CTDB_CONTROL_DB_FREEZE = 141,
|
---|
360 | CTDB_CONTROL_DB_THAW = 142,
|
---|
361 | CTDB_CONTROL_DB_TRANSACTION_START = 143,
|
---|
362 | CTDB_CONTROL_DB_TRANSACTION_COMMIT = 144,
|
---|
363 | CTDB_CONTROL_DB_TRANSACTION_CANCEL = 145,
|
---|
364 | CTDB_CONTROL_DB_PULL = 146,
|
---|
365 | CTDB_CONTROL_DB_PUSH_START = 147,
|
---|
366 | CTDB_CONTROL_DB_PUSH_CONFIRM = 148,
|
---|
367 | };
|
---|
368 |
|
---|
369 | #define CTDB_MONITORING_ACTIVE 0
|
---|
370 | #define CTDB_MONITORING_DISABLED 1
|
---|
371 |
|
---|
372 | #define MAX_COUNT_BUCKETS 16
|
---|
373 | #define MAX_HOT_KEYS 10
|
---|
374 |
|
---|
375 | struct ctdb_latency_counter {
|
---|
376 | int num;
|
---|
377 | double min;
|
---|
378 | double max;
|
---|
379 | double total;
|
---|
380 | };
|
---|
381 |
|
---|
382 | struct ctdb_statistics {
|
---|
383 | uint32_t num_clients;
|
---|
384 | uint32_t frozen;
|
---|
385 | uint32_t recovering;
|
---|
386 | uint32_t client_packets_sent;
|
---|
387 | uint32_t client_packets_recv;
|
---|
388 | uint32_t node_packets_sent;
|
---|
389 | uint32_t node_packets_recv;
|
---|
390 | uint32_t keepalive_packets_sent;
|
---|
391 | uint32_t keepalive_packets_recv;
|
---|
392 | struct {
|
---|
393 | uint32_t req_call;
|
---|
394 | uint32_t reply_call;
|
---|
395 | uint32_t req_dmaster;
|
---|
396 | uint32_t reply_dmaster;
|
---|
397 | uint32_t reply_error;
|
---|
398 | uint32_t req_message;
|
---|
399 | uint32_t req_control;
|
---|
400 | uint32_t reply_control;
|
---|
401 | } node;
|
---|
402 | struct {
|
---|
403 | uint32_t req_call;
|
---|
404 | uint32_t req_message;
|
---|
405 | uint32_t req_control;
|
---|
406 | } client;
|
---|
407 | struct {
|
---|
408 | uint32_t call;
|
---|
409 | uint32_t control;
|
---|
410 | uint32_t traverse;
|
---|
411 | } timeouts;
|
---|
412 | struct {
|
---|
413 | struct ctdb_latency_counter ctdbd;
|
---|
414 | struct ctdb_latency_counter recd;
|
---|
415 | } reclock;
|
---|
416 | struct {
|
---|
417 | uint32_t num_calls;
|
---|
418 | uint32_t num_current;
|
---|
419 | uint32_t num_pending;
|
---|
420 | uint32_t num_failed;
|
---|
421 | struct ctdb_latency_counter latency;
|
---|
422 | uint32_t buckets[MAX_COUNT_BUCKETS];
|
---|
423 | } locks;
|
---|
424 | uint32_t total_calls;
|
---|
425 | uint32_t pending_calls;
|
---|
426 | uint32_t childwrite_calls;
|
---|
427 | uint32_t pending_childwrite_calls;
|
---|
428 | uint32_t memory_used;
|
---|
429 | uint32_t __last_counter; /* hack */
|
---|
430 | uint32_t max_hop_count;
|
---|
431 | uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
|
---|
432 | struct ctdb_latency_counter call_latency;
|
---|
433 | struct ctdb_latency_counter childwrite_latency;
|
---|
434 | uint32_t num_recoveries;
|
---|
435 | struct timeval statistics_start_time;
|
---|
436 | struct timeval statistics_current_time;
|
---|
437 | uint32_t total_ro_delegations;
|
---|
438 | uint32_t total_ro_revokes;
|
---|
439 | };
|
---|
440 |
|
---|
441 | #define INVALID_GENERATION 1
|
---|
442 | /* table that contains the mapping between a hash value and lmaster
|
---|
443 | */
|
---|
444 | struct ctdb_vnn_map {
|
---|
445 | uint32_t generation;
|
---|
446 | uint32_t size;
|
---|
447 | uint32_t *map;
|
---|
448 | };
|
---|
449 |
|
---|
450 | struct ctdb_dbid {
|
---|
451 | uint32_t db_id;
|
---|
452 | #define CTDB_DB_FLAGS_PERSISTENT 0x01
|
---|
453 | #define CTDB_DB_FLAGS_READONLY 0x02
|
---|
454 | #define CTDB_DB_FLAGS_STICKY 0x04
|
---|
455 | uint8_t flags;
|
---|
456 | };
|
---|
457 |
|
---|
458 | struct ctdb_dbid_map {
|
---|
459 | uint32_t num;
|
---|
460 | struct ctdb_dbid *dbs;
|
---|
461 | };
|
---|
462 |
|
---|
463 | struct ctdb_pulldb {
|
---|
464 | uint32_t db_id;
|
---|
465 | #define CTDB_LMASTER_ANY 0xffffffff
|
---|
466 | uint32_t lmaster;
|
---|
467 | };
|
---|
468 |
|
---|
469 | struct ctdb_pulldb_ext {
|
---|
470 | uint32_t db_id;
|
---|
471 | uint32_t lmaster;
|
---|
472 | uint64_t srvid;
|
---|
473 | };
|
---|
474 |
|
---|
475 | #define CTDB_RECOVERY_NORMAL 0
|
---|
476 | #define CTDB_RECOVERY_ACTIVE 1
|
---|
477 |
|
---|
478 | #define CTDB_NUM_DB_PRIORITIES 3
|
---|
479 |
|
---|
480 | /*
|
---|
481 | the extended header for records in the ltdb
|
---|
482 | */
|
---|
483 | struct ctdb_ltdb_header {
|
---|
484 | uint64_t rsn;
|
---|
485 | uint32_t dmaster;
|
---|
486 | uint32_t reserved1;
|
---|
487 | #define CTDB_REC_FLAG_DEFAULT 0x00000000
|
---|
488 | #define CTDB_REC_FLAG_MIGRATED_WITH_DATA 0x00010000
|
---|
489 | #define CTDB_REC_FLAG_VACUUM_MIGRATED 0x00020000
|
---|
490 | #define CTDB_REC_FLAG_AUTOMATIC 0x00040000
|
---|
491 | #define CTDB_REC_RO_HAVE_DELEGATIONS 0x01000000
|
---|
492 | #define CTDB_REC_RO_HAVE_READONLY 0x02000000
|
---|
493 | #define CTDB_REC_RO_REVOKING_READONLY 0x04000000
|
---|
494 | #define CTDB_REC_RO_REVOKE_COMPLETE 0x08000000
|
---|
495 | #define CTDB_REC_RO_FLAGS (CTDB_REC_RO_HAVE_DELEGATIONS|\
|
---|
496 | CTDB_REC_RO_HAVE_READONLY|\
|
---|
497 | CTDB_REC_RO_REVOKING_READONLY|\
|
---|
498 | CTDB_REC_RO_REVOKE_COMPLETE)
|
---|
499 | uint32_t flags;
|
---|
500 | };
|
---|
501 |
|
---|
502 | struct ctdb_rec_data {
|
---|
503 | uint32_t reqid;
|
---|
504 | struct ctdb_ltdb_header *header;
|
---|
505 | TDB_DATA key, data;
|
---|
506 | };
|
---|
507 |
|
---|
508 | struct ctdb_rec_buffer {
|
---|
509 | uint32_t db_id;
|
---|
510 | uint32_t count;
|
---|
511 | uint8_t *buf;
|
---|
512 | size_t buflen;
|
---|
513 | };
|
---|
514 |
|
---|
515 | typedef int (*ctdb_rec_parser_func_t)(uint32_t reqid,
|
---|
516 | struct ctdb_ltdb_header *header,
|
---|
517 | TDB_DATA key, TDB_DATA data,
|
---|
518 | void *private_data);
|
---|
519 |
|
---|
520 | struct ctdb_traverse_start {
|
---|
521 | uint32_t db_id;
|
---|
522 | uint32_t reqid;
|
---|
523 | uint64_t srvid;
|
---|
524 | };
|
---|
525 |
|
---|
526 | struct ctdb_traverse_all {
|
---|
527 | uint32_t db_id;
|
---|
528 | uint32_t reqid;
|
---|
529 | uint32_t pnn;
|
---|
530 | uint32_t client_reqid;
|
---|
531 | uint64_t srvid;
|
---|
532 | };
|
---|
533 |
|
---|
534 | struct ctdb_traverse_start_ext {
|
---|
535 | uint32_t db_id;
|
---|
536 | uint32_t reqid;
|
---|
537 | uint64_t srvid;
|
---|
538 | bool withemptyrecords;
|
---|
539 | };
|
---|
540 |
|
---|
541 | struct ctdb_traverse_all_ext {
|
---|
542 | uint32_t db_id;
|
---|
543 | uint32_t reqid;
|
---|
544 | uint32_t pnn;
|
---|
545 | uint32_t client_reqid;
|
---|
546 | uint64_t srvid;
|
---|
547 | bool withemptyrecords;
|
---|
548 | };
|
---|
549 |
|
---|
550 | typedef union {
|
---|
551 | struct sockaddr sa;
|
---|
552 | struct sockaddr_in ip;
|
---|
553 | struct sockaddr_in6 ip6;
|
---|
554 | } ctdb_sock_addr;
|
---|
555 |
|
---|
556 | struct ctdb_connection {
|
---|
557 | ctdb_sock_addr src;
|
---|
558 | ctdb_sock_addr dst;
|
---|
559 | };
|
---|
560 |
|
---|
561 | struct ctdb_tunable {
|
---|
562 | const char *name;
|
---|
563 | uint32_t value;
|
---|
564 | };
|
---|
565 |
|
---|
566 | struct ctdb_var_list {
|
---|
567 | int count;
|
---|
568 | const char **var;
|
---|
569 | };
|
---|
570 |
|
---|
571 | struct ctdb_node_flag_change {
|
---|
572 | uint32_t pnn;
|
---|
573 | uint32_t new_flags;
|
---|
574 | uint32_t old_flags;
|
---|
575 | };
|
---|
576 |
|
---|
577 | /* all tunable variables go in here */
|
---|
578 | struct ctdb_tunable_list {
|
---|
579 | uint32_t max_redirect_count;
|
---|
580 | uint32_t seqnum_interval; /* unit is ms */
|
---|
581 | uint32_t control_timeout;
|
---|
582 | uint32_t traverse_timeout;
|
---|
583 | uint32_t keepalive_interval;
|
---|
584 | uint32_t keepalive_limit;
|
---|
585 | uint32_t recover_timeout;
|
---|
586 | uint32_t recover_interval;
|
---|
587 | uint32_t election_timeout;
|
---|
588 | uint32_t takeover_timeout;
|
---|
589 | uint32_t monitor_interval;
|
---|
590 | uint32_t tickle_update_interval;
|
---|
591 | uint32_t script_timeout;
|
---|
592 | uint32_t monitor_timeout_count; /* allow dodgy scripts to hang this many times in a row before we mark the node unhealthy */
|
---|
593 | uint32_t script_unhealthy_on_timeout; /* obsolete */
|
---|
594 | uint32_t recovery_grace_period;
|
---|
595 | uint32_t recovery_ban_period;
|
---|
596 | uint32_t database_hash_size;
|
---|
597 | uint32_t database_max_dead;
|
---|
598 | uint32_t rerecovery_timeout;
|
---|
599 | uint32_t enable_bans;
|
---|
600 | uint32_t deterministic_public_ips;
|
---|
601 | uint32_t reclock_ping_period;
|
---|
602 | uint32_t no_ip_failback;
|
---|
603 | uint32_t disable_ip_failover;
|
---|
604 | uint32_t verbose_memory_names;
|
---|
605 | uint32_t recd_ping_timeout;
|
---|
606 | uint32_t recd_ping_failcount;
|
---|
607 | uint32_t log_latency_ms;
|
---|
608 | uint32_t reclock_latency_ms;
|
---|
609 | uint32_t recovery_drop_all_ips;
|
---|
610 | uint32_t verify_recovery_lock;
|
---|
611 | uint32_t vacuum_interval;
|
---|
612 | uint32_t vacuum_max_run_time;
|
---|
613 | uint32_t repack_limit;
|
---|
614 | uint32_t vacuum_limit;
|
---|
615 | uint32_t max_queue_depth_drop_msg;
|
---|
616 | uint32_t allow_unhealthy_db_read;
|
---|
617 | uint32_t stat_history_interval;
|
---|
618 | uint32_t deferred_attach_timeout;
|
---|
619 | uint32_t vacuum_fast_path_count;
|
---|
620 | uint32_t lcp2_public_ip_assignment;
|
---|
621 | uint32_t allow_client_db_attach;
|
---|
622 | uint32_t recover_pdb_by_seqnum;
|
---|
623 | uint32_t deferred_rebalance_on_node_add;
|
---|
624 | uint32_t fetch_collapse;
|
---|
625 | uint32_t hopcount_make_sticky;
|
---|
626 | uint32_t sticky_duration;
|
---|
627 | uint32_t sticky_pindown;
|
---|
628 | uint32_t no_ip_takeover;
|
---|
629 | uint32_t db_record_count_warn;
|
---|
630 | uint32_t db_record_size_warn;
|
---|
631 | uint32_t db_size_warn;
|
---|
632 | uint32_t pulldb_preallocation_size;
|
---|
633 | uint32_t no_ip_host_on_all_disabled;
|
---|
634 | uint32_t samba3_hack;
|
---|
635 | uint32_t mutex_enabled;
|
---|
636 | uint32_t lock_processes_per_db;
|
---|
637 | uint32_t rec_buffer_size_limit;
|
---|
638 | };
|
---|
639 |
|
---|
640 | struct ctdb_tickle_list {
|
---|
641 | ctdb_sock_addr addr;
|
---|
642 | uint32_t num;
|
---|
643 | struct ctdb_connection *conn;
|
---|
644 | };
|
---|
645 |
|
---|
646 | enum ctdb_client_type {
|
---|
647 | SERVER_TYPE_CTDB = 0,
|
---|
648 | SERVER_TYPE_SAMBA = 1,
|
---|
649 | SERVER_TYPE_NFSD = 2,
|
---|
650 | SERVER_TYPE_ISCSID = 3
|
---|
651 | };
|
---|
652 |
|
---|
653 | struct ctdb_client_id {
|
---|
654 | enum ctdb_client_type type;
|
---|
655 | uint32_t pnn;
|
---|
656 | uint32_t server_id;
|
---|
657 | };
|
---|
658 |
|
---|
659 | struct ctdb_client_id_list {
|
---|
660 | uint32_t num;
|
---|
661 | struct ctdb_client_id *cid;
|
---|
662 | };
|
---|
663 |
|
---|
664 | struct ctdb_client_id_map {
|
---|
665 | int count;
|
---|
666 | struct ctdb_client_id_list *list;
|
---|
667 | };
|
---|
668 |
|
---|
669 | struct ctdb_addr_info {
|
---|
670 | ctdb_sock_addr addr;
|
---|
671 | uint32_t mask;
|
---|
672 | const char *iface;
|
---|
673 | };
|
---|
674 |
|
---|
675 | struct ctdb_transdb {
|
---|
676 | uint32_t db_id;
|
---|
677 | uint32_t tid;
|
---|
678 | };
|
---|
679 |
|
---|
680 | struct ctdb_uptime {
|
---|
681 | struct timeval current_time;
|
---|
682 | struct timeval ctdbd_start_time;
|
---|
683 | struct timeval last_recovery_started;
|
---|
684 | struct timeval last_recovery_finished;
|
---|
685 | };
|
---|
686 |
|
---|
687 | struct ctdb_public_ip {
|
---|
688 | uint32_t pnn;
|
---|
689 | ctdb_sock_addr addr;
|
---|
690 | };
|
---|
691 |
|
---|
692 | struct ctdb_public_ip_list {
|
---|
693 | uint32_t num;
|
---|
694 | struct ctdb_public_ip *ip;
|
---|
695 | };
|
---|
696 |
|
---|
697 | /*
|
---|
698 | * Node flags
|
---|
699 | */
|
---|
700 | #define NODE_FLAGS_DISCONNECTED 0x00000001 /* node isn't connected */
|
---|
701 | #define NODE_FLAGS_UNHEALTHY 0x00000002 /* monitoring says node is unhealthy */
|
---|
702 | #define NODE_FLAGS_PERMANENTLY_DISABLED 0x00000004 /* administrator has disabled node */
|
---|
703 | #define NODE_FLAGS_BANNED 0x00000008 /* recovery daemon has banned the node */
|
---|
704 | #define NODE_FLAGS_DELETED 0x00000010 /* this node has been deleted */
|
---|
705 | #define NODE_FLAGS_STOPPED 0x00000020 /* this node has been stopped */
|
---|
706 | #define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
|
---|
707 | #define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
|
---|
708 |
|
---|
709 | /*
|
---|
710 | * Node capabilities
|
---|
711 | */
|
---|
712 | #define CTDB_CAP_RECMASTER 0x00000001
|
---|
713 | #define CTDB_CAP_LMASTER 0x00000002
|
---|
714 | /* This capability is set if CTDB_LVS_PUBLIC_IP is set */
|
---|
715 | #define CTDB_CAP_LVS 0x00000004
|
---|
716 | /* This capability is set if NATGW is enabled */
|
---|
717 | #define CTDB_CAP_NATGW 0x00000008
|
---|
718 |
|
---|
719 | /*
|
---|
720 | * Node features
|
---|
721 | */
|
---|
722 | #define CTDB_CAP_PARALLEL_RECOVERY 0x00010000
|
---|
723 | #define CTDB_CAP_FRAGMENTED_CONTROLS 0x00020000
|
---|
724 |
|
---|
725 | #define CTDB_CAP_FEATURES (CTDB_CAP_PARALLEL_RECOVERY | \
|
---|
726 | CTDB_CAP_FRAGMENTED_CONTROLS)
|
---|
727 |
|
---|
728 | #define CTDB_CAP_DEFAULT (CTDB_CAP_RECMASTER | \
|
---|
729 | CTDB_CAP_LMASTER | \
|
---|
730 | CTDB_CAP_FEATURES)
|
---|
731 |
|
---|
732 | struct ctdb_node_and_flags {
|
---|
733 | uint32_t pnn;
|
---|
734 | uint32_t flags;
|
---|
735 | ctdb_sock_addr addr;
|
---|
736 | };
|
---|
737 |
|
---|
738 | struct ctdb_node_map {
|
---|
739 | uint32_t num;
|
---|
740 | struct ctdb_node_and_flags *node;
|
---|
741 | };
|
---|
742 |
|
---|
743 | enum ctdb_event {
|
---|
744 | CTDB_EVENT_INIT, /* CTDB starting up: no args */
|
---|
745 | CTDB_EVENT_SETUP, /* CTDB starting up after transport is readdy: no args. */
|
---|
746 | CTDB_EVENT_STARTUP, /* CTDB starting up after initial recovery: no args. */
|
---|
747 | CTDB_EVENT_START_RECOVERY, /* CTDB recovery starting: no args. */
|
---|
748 | CTDB_EVENT_RECOVERED, /* CTDB recovery finished: no args. */
|
---|
749 | CTDB_EVENT_TAKE_IP, /* IP taken: interface, IP address, netmask bits. */
|
---|
750 | CTDB_EVENT_RELEASE_IP, /* IP released: interface, IP address, netmask bits. */
|
---|
751 | CTDB_EVENT_STOPPED, /* Deprecated, do not use. */
|
---|
752 | CTDB_EVENT_MONITOR, /* Please check if service is healthy: no args. */
|
---|
753 | CTDB_EVENT_STATUS, /* Deprecated, do not use. */
|
---|
754 | CTDB_EVENT_SHUTDOWN, /* CTDB shutting down: no args. */
|
---|
755 | CTDB_EVENT_RELOAD, /* Deprecated, do not use */
|
---|
756 | CTDB_EVENT_UPDATE_IP, /* IP updating: old interface, new interface, IP address, netmask bits. */
|
---|
757 | CTDB_EVENT_IPREALLOCATED, /* when a takeover_run() completes */
|
---|
758 | CTDB_EVENT_MAX
|
---|
759 | };
|
---|
760 |
|
---|
761 | #define MAX_SCRIPT_NAME 31
|
---|
762 | #define MAX_SCRIPT_OUTPUT 511
|
---|
763 |
|
---|
764 | struct ctdb_script {
|
---|
765 | char name[MAX_SCRIPT_NAME+1];
|
---|
766 | struct timeval start;
|
---|
767 | struct timeval finished;
|
---|
768 | int32_t status;
|
---|
769 | char output[MAX_SCRIPT_OUTPUT+1];
|
---|
770 | };
|
---|
771 |
|
---|
772 | struct ctdb_script_list {
|
---|
773 | uint32_t num_scripts;
|
---|
774 | struct ctdb_script *script;
|
---|
775 | };
|
---|
776 |
|
---|
777 | struct ctdb_ban_state {
|
---|
778 | uint32_t pnn;
|
---|
779 | uint32_t time;
|
---|
780 | };
|
---|
781 |
|
---|
782 | struct ctdb_db_priority {
|
---|
783 | uint32_t db_id;
|
---|
784 | uint32_t priority;
|
---|
785 | };
|
---|
786 |
|
---|
787 | struct ctdb_notify_data {
|
---|
788 | uint64_t srvid;
|
---|
789 | TDB_DATA data;
|
---|
790 | };
|
---|
791 |
|
---|
792 | #ifdef IFNAMSIZ
|
---|
793 | #define CTDB_IFACE_SIZE IFNAMSIZ
|
---|
794 | #else
|
---|
795 | #define CTDB_IFACE_SIZE 16
|
---|
796 | #endif
|
---|
797 |
|
---|
798 | struct ctdb_iface {
|
---|
799 | char name[CTDB_IFACE_SIZE+2];
|
---|
800 | uint16_t link_state;
|
---|
801 | uint32_t references;
|
---|
802 | };
|
---|
803 |
|
---|
804 | struct ctdb_iface_list {
|
---|
805 | uint32_t num;
|
---|
806 | struct ctdb_iface *iface;
|
---|
807 | };
|
---|
808 |
|
---|
809 | struct ctdb_public_ip_info {
|
---|
810 | struct ctdb_public_ip ip;
|
---|
811 | uint32_t active_idx;
|
---|
812 | struct ctdb_iface_list *ifaces;
|
---|
813 | };
|
---|
814 |
|
---|
815 | struct ctdb_statistics_list {
|
---|
816 | int num;
|
---|
817 | struct ctdb_statistics *stats;
|
---|
818 | };
|
---|
819 |
|
---|
820 | struct ctdb_key_data {
|
---|
821 | uint32_t db_id;
|
---|
822 | struct ctdb_ltdb_header header;
|
---|
823 | TDB_DATA key;
|
---|
824 | };
|
---|
825 |
|
---|
826 | struct ctdb_uint8_array {
|
---|
827 | int num;
|
---|
828 | uint8_t *val;
|
---|
829 | };
|
---|
830 |
|
---|
831 | struct ctdb_uint64_array {
|
---|
832 | int num;
|
---|
833 | uint64_t *val;
|
---|
834 | };
|
---|
835 |
|
---|
836 | struct ctdb_db_statistics {
|
---|
837 | struct {
|
---|
838 | uint32_t num_calls;
|
---|
839 | uint32_t num_current;
|
---|
840 | uint32_t num_pending;
|
---|
841 | uint32_t num_failed;
|
---|
842 | struct ctdb_latency_counter latency;
|
---|
843 | uint32_t buckets[MAX_COUNT_BUCKETS];
|
---|
844 | } locks;
|
---|
845 | struct {
|
---|
846 | struct ctdb_latency_counter latency;
|
---|
847 | } vacuum;
|
---|
848 | uint32_t db_ro_delegations;
|
---|
849 | uint32_t db_ro_revokes;
|
---|
850 | uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
|
---|
851 | uint32_t num_hot_keys;
|
---|
852 | struct {
|
---|
853 | uint32_t count;
|
---|
854 | TDB_DATA key;
|
---|
855 | } hot_keys[MAX_HOT_KEYS];
|
---|
856 | };
|
---|
857 |
|
---|
858 | enum ctdb_runstate {
|
---|
859 | CTDB_RUNSTATE_UNKNOWN,
|
---|
860 | CTDB_RUNSTATE_INIT,
|
---|
861 | CTDB_RUNSTATE_SETUP,
|
---|
862 | CTDB_RUNSTATE_FIRST_RECOVERY,
|
---|
863 | CTDB_RUNSTATE_STARTUP,
|
---|
864 | CTDB_RUNSTATE_RUNNING,
|
---|
865 | CTDB_RUNSTATE_SHUTDOWN,
|
---|
866 | };
|
---|
867 |
|
---|
868 | struct ctdb_req_control_data {
|
---|
869 | uint32_t opcode;
|
---|
870 | union {
|
---|
871 | pid_t pid;
|
---|
872 | uint32_t db_id;
|
---|
873 | struct ctdb_vnn_map *vnnmap;
|
---|
874 | uint32_t loglevel;
|
---|
875 | struct ctdb_pulldb *pulldb;
|
---|
876 | struct ctdb_pulldb_ext *pulldb_ext;
|
---|
877 | struct ctdb_rec_buffer *recbuf;
|
---|
878 | uint32_t recmode;
|
---|
879 | const char *db_name;
|
---|
880 | struct ctdb_traverse_start *traverse_start;
|
---|
881 | struct ctdb_traverse_all *traverse_all;
|
---|
882 | struct ctdb_rec_data *rec_data;
|
---|
883 | uint32_t recmaster;
|
---|
884 | struct ctdb_connection *conn;
|
---|
885 | struct ctdb_tunable *tunable;
|
---|
886 | const char *tun_var;
|
---|
887 | struct ctdb_node_flag_change *flag_change;
|
---|
888 | ctdb_sock_addr *addr;
|
---|
889 | struct ctdb_tickle_list *tickles;
|
---|
890 | struct ctdb_client_id *cid;
|
---|
891 | struct ctdb_addr_info *addr_info;
|
---|
892 | uint32_t tid;
|
---|
893 | struct ctdb_transdb *transdb;
|
---|
894 | const char *event_str;
|
---|
895 | struct ctdb_public_ip *pubip;
|
---|
896 | enum ctdb_event event;
|
---|
897 | double reclock_latency;
|
---|
898 | const char *reclock_file;
|
---|
899 | uint32_t role;
|
---|
900 | const char *script;
|
---|
901 | struct ctdb_ban_state *ban_state;
|
---|
902 | struct ctdb_db_priority *db_prio;
|
---|
903 | struct ctdb_notify_data *notify;
|
---|
904 | uint64_t srvid;
|
---|
905 | struct ctdb_iface *iface;
|
---|
906 | struct ctdb_key_data *key;
|
---|
907 | struct ctdb_uint64_array *u64_array;
|
---|
908 | struct ctdb_traverse_start_ext *traverse_start_ext;
|
---|
909 | struct ctdb_traverse_all_ext *traverse_all_ext;
|
---|
910 | } data;
|
---|
911 | };
|
---|
912 |
|
---|
913 | struct ctdb_reply_control_data {
|
---|
914 | uint32_t opcode;
|
---|
915 | union {
|
---|
916 | struct ctdb_statistics *stats;
|
---|
917 | const char *db_path;
|
---|
918 | struct ctdb_vnn_map *vnnmap;
|
---|
919 | uint32_t loglevel;
|
---|
920 | struct ctdb_dbid_map *dbmap;
|
---|
921 | struct ctdb_rec_buffer *recbuf;
|
---|
922 | uint32_t db_id;
|
---|
923 | const char *db_name;
|
---|
924 | const char *mem_str;
|
---|
925 | uint32_t tun_value;
|
---|
926 | struct ctdb_var_list *tun_var_list;
|
---|
927 | struct ctdb_tunable_list *tun_list;
|
---|
928 | struct ctdb_tickle_list *tickles;
|
---|
929 | struct ctdb_client_id_map *cid_map;
|
---|
930 | struct ctdb_uptime *uptime;
|
---|
931 | uint32_t caps;
|
---|
932 | struct ctdb_public_ip_list *pubip_list;
|
---|
933 | struct ctdb_node_map *nodemap;
|
---|
934 | struct ctdb_script_list *script_list;
|
---|
935 | const char *reclock_file;
|
---|
936 | struct ctdb_ban_state *ban_state;
|
---|
937 | uint64_t seqnum;
|
---|
938 | const char *reason;
|
---|
939 | struct ctdb_public_ip_info *ipinfo;
|
---|
940 | struct ctdb_iface_list *iface_list;
|
---|
941 | struct ctdb_statistics_list *stats_list;
|
---|
942 | struct ctdb_uint8_array *u8_array;
|
---|
943 | struct ctdb_db_statistics *dbstats;
|
---|
944 | enum ctdb_runstate runstate;
|
---|
945 | uint32_t num_records;
|
---|
946 | } data;
|
---|
947 | };
|
---|
948 |
|
---|
949 | struct ctdb_req_control {
|
---|
950 | uint32_t opcode;
|
---|
951 | uint32_t pad;
|
---|
952 | uint64_t srvid;
|
---|
953 | uint32_t client_id;
|
---|
954 | #define CTDB_CTRL_FLAG_NOREPLY 1
|
---|
955 | #define CTDB_CTRL_FLAG_OPCODE_SPECIFIC 0xFFFF0000
|
---|
956 | uint32_t flags;
|
---|
957 | struct ctdb_req_control_data rdata;
|
---|
958 | };
|
---|
959 |
|
---|
960 | struct ctdb_reply_control {
|
---|
961 | int32_t status;
|
---|
962 | const char *errmsg;
|
---|
963 | struct ctdb_reply_control_data rdata;
|
---|
964 | };
|
---|
965 |
|
---|
966 | struct ctdb_election_message {
|
---|
967 | uint32_t num_connected;
|
---|
968 | struct timeval priority_time;
|
---|
969 | uint32_t pnn;
|
---|
970 | uint32_t node_flags;
|
---|
971 | };
|
---|
972 |
|
---|
973 | struct ctdb_srvid_message {
|
---|
974 | uint32_t pnn;
|
---|
975 | uint64_t srvid;
|
---|
976 | };
|
---|
977 |
|
---|
978 | struct ctdb_disable_message {
|
---|
979 | uint32_t pnn;
|
---|
980 | uint64_t srvid;
|
---|
981 | uint32_t timeout;
|
---|
982 | };
|
---|
983 |
|
---|
984 | union ctdb_message_data {
|
---|
985 | /* SRVID_ELECTION */
|
---|
986 | struct ctdb_election_message *election;
|
---|
987 | /* SRVID_RELEASE_IP, SRVID_TAKE_IP */
|
---|
988 | const char *ipaddr;
|
---|
989 | /* SRVID_SET_NODE_FLAGS, SERVID_PUSH_NODE_FLAGS */
|
---|
990 | struct ctdb_node_flag_change *flag_change;
|
---|
991 | /* SRVID_RECD_UPDATE_IP */
|
---|
992 | struct ctdb_public_ip *pubip;
|
---|
993 | /* SRVID_VACUUM_FETCH */
|
---|
994 | struct ctdb_rec_buffer *recbuf;
|
---|
995 | /* SRVID_DETACH_DATABASE */
|
---|
996 | uint32_t db_id;
|
---|
997 | /* SRVID_MEM_DUMP, SRVID_TAKEOVER_RUN */
|
---|
998 | struct ctdb_srvid_message *msg;
|
---|
999 | /* SRVID_BANNING, SRVID_REBALANCE_NODE */
|
---|
1000 | uint32_t pnn;
|
---|
1001 | /* SRVID_DISABLE_TAKEOVER_RUNS, SRVID_DISABLE_RECOVERIES */
|
---|
1002 | struct ctdb_disable_message *disable;
|
---|
1003 | /* SRVID_DISABLE_IP_CHECK */
|
---|
1004 | uint32_t timeout;
|
---|
1005 | /* Other */
|
---|
1006 | TDB_DATA data;
|
---|
1007 | };
|
---|
1008 |
|
---|
1009 | struct ctdb_req_message {
|
---|
1010 | uint64_t srvid;
|
---|
1011 | union ctdb_message_data data;
|
---|
1012 | };
|
---|
1013 |
|
---|
1014 | struct ctdb_req_message_data {
|
---|
1015 | uint64_t srvid;
|
---|
1016 | TDB_DATA data;
|
---|
1017 | };
|
---|
1018 |
|
---|
1019 | /* This is equivalent to server_id */
|
---|
1020 | struct ctdb_server_id {
|
---|
1021 | uint64_t pid;
|
---|
1022 | uint32_t task_id;
|
---|
1023 | uint32_t vnn;
|
---|
1024 | uint64_t unique_id;
|
---|
1025 | };
|
---|
1026 |
|
---|
1027 | enum ctdb_g_lock_type {
|
---|
1028 | CTDB_G_LOCK_READ = 0,
|
---|
1029 | CTDB_G_LOCK_WRITE = 1,
|
---|
1030 | };
|
---|
1031 |
|
---|
1032 | struct ctdb_g_lock {
|
---|
1033 | enum ctdb_g_lock_type type;
|
---|
1034 | struct ctdb_server_id sid;
|
---|
1035 | };
|
---|
1036 |
|
---|
1037 | struct ctdb_g_lock_list {
|
---|
1038 | unsigned int num;
|
---|
1039 | struct ctdb_g_lock *lock;
|
---|
1040 | };
|
---|
1041 |
|
---|
1042 | #endif /* __CTDB_PROTOCOL_H__ */
|
---|