s3:net_idmap_delete do not lock two records at the same time
[Samba/gebeck_regimport.git] / ctdb / include / ctdb_protocol.h
blob33187c78428655a6a48ec8d0fdc06b4023c99824
1 /*
2 ctdb database library
4 Copyright (C) Andrew Tridgell 2006
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.
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.
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/>.
20 #ifndef _CTDB_PROTOCOL_H
21 #define _CTDB_PROTOCOL_H
23 /* location of daemon socket */
24 #define CTDB_PATH "/tmp/ctdb.socket"
26 /* default ctdb port number */
27 #define CTDB_PORT 4379
29 /* we must align packets to ensure ctdb works on all architectures (eg. sparc) */
30 #define CTDB_DS_ALIGNMENT 8
33 #define CTDB_NULL_FUNC 0xFF000001
34 #define CTDB_FETCH_FUNC 0xFF000002
35 #define CTDB_FETCH_WITH_HEADER_FUNC 0xFF000003
38 struct ctdb_call {
39 int call_id;
40 TDB_DATA key;
41 TDB_DATA call_data;
42 TDB_DATA reply_data;
43 uint32_t status;
44 #define CTDB_IMMEDIATE_MIGRATION 0x00000001
45 #define CTDB_CALL_FLAG_VACUUM_MIGRATION 0x00000002
46 #define CTDB_WANT_READONLY 0x00000004
47 uint32_t flags;
51 structure passed to a ctdb call backend function
53 struct ctdb_call_info {
54 TDB_DATA key; /* record key */
55 struct ctdb_ltdb_header *header;
56 TDB_DATA record_data; /* current data in the record */
57 TDB_DATA *new_data; /* optionally updated record data */
58 TDB_DATA *call_data; /* optionally passed from caller */
59 TDB_DATA *reply_data; /* optionally returned by function */
60 uint32_t status; /* optional reply status - defaults to zero */
63 #define CTDB_ERR_INVALID 1
64 #define CTDB_ERR_NOMEM 2
67 ctdb flags
69 #define CTDB_FLAG_TORTURE (1<<1)
72 a message handler ID meaning "give me all messages"
74 #define CTDB_SRVID_ALL (~(uint64_t)0)
77 srvid type : RECOVERY
79 #define CTDB_SRVID_RECOVERY 0xF100000000000000LL
82 a message handler ID meaning that the cluster has been reconfigured
84 #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
87 a message handler ID meaning that an IP address has been released
89 #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
92 a message handler ID meaning that an IP address has been taken
94 #define CTDB_SRVID_TAKE_IP 0xF301000000000000LL
97 a message ID to set the node flags in the recovery daemon
99 #define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
102 a message ID to ask the recovery daemon to update the expected node
103 assignment for a public ip
105 #define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
108 a message to tell the recovery daemon to fetch a set of records
110 #define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
113 a message to tell the recovery daemon to write a talloc memdump
114 to the log
116 #define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
119 a message ID to get the recovery daemon to push the node flags out
121 #define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
124 a message ID to get the recovery daemon to reload the nodes file
126 #define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
129 a message ID to get the recovery daemon to perform a takeover run
131 #define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
133 /* request recovery daemon to rebalance ips for a node.
134 input is uint32_t for the node id.
136 #define CTDB_SRVID_REBALANCE_NODE 0xFB01000000000000LL
139 a message handler ID meaning to ask recovery master to reload all ips
141 #define CTDB_SRVID_RELOAD_ALL_IPS 0xFB02000000000000LL
143 /* A message id to ask the recovery daemon to temporarily disable the
144 public ip checks
146 #define CTDB_SRVID_DISABLE_IP_CHECK 0xFC00000000000000LL
148 /* A dummy port used for sending back ipreallocate resposnes to the main
149 daemon
151 #define CTDB_SRVID_TAKEOVER_RUN_RESPONSE 0xFD00000000000000LL
153 /* A range of ports reserved for registering a PID (top 8 bits)
154 * All ports matching the 8 top bits are reserved for exclusive use by
155 * registering a SRVID that matches the process-id of the requesting process
157 #define CTDB_SRVID_PID_RANGE 0x0000000000000000LL
159 /* A range of ports reserved for samba (top 8 bits)
160 * All ports matching the 8 top bits are reserved for exclusive use by
161 * CIFS server
163 #define CTDB_SRVID_SAMBA_NOTIFY 0xFE00000000000000LL
164 #define CTDB_SRVID_SAMBA_RANGE 0xFE00000000000000LL
166 /* A range of ports reserved for a CTDB NFS server (top 8 bits)
167 * All ports matching the 8 top bits are reserved for exclusive use by
168 * NFS server
170 #define CTDB_SRVID_NFSD_RANGE 0xEE00000000000000LL
172 /* A range of ports reserved for a CTDB ISCSI server (top 8 bits)
173 * All ports matching the 8 top bits are reserved for exclusive use by
174 * ISCSI server
176 #define CTDB_SRVID_ISCSID_RANGE 0xDE00000000000000LL
178 /* A range of ports reserved for testing (top 8 bits)
179 * All ports matching the 8 top bits are reserved for exclusive use by
180 * test applications
182 #define CTDB_SRVID_TEST_RANGE 0xCE00000000000000LL
184 /* Range of ports reserved for traversals */
185 #define CTDB_SRVID_TRAVERSE_RANGE 0xBE00000000000000LL
187 /* used on the domain socket, send a pdu to the local daemon */
188 #define CTDB_CURRENT_NODE 0xF0000001
189 /* send a broadcast to all nodes in the cluster, active or not */
190 #define CTDB_BROADCAST_ALL 0xF0000002
191 /* send a broadcast to all nodes in the current vnn map */
192 #define CTDB_BROADCAST_VNNMAP 0xF0000003
193 /* send a broadcast to all connected nodes */
194 #define CTDB_BROADCAST_CONNECTED 0xF0000004
195 /* send a broadcast to selected connected nodes */
196 #define CTDB_MULTICAST 0xF0000005
198 /* the key used for transaction locking on persistent databases */
199 #define CTDB_TRANSACTION_LOCK_KEY "__transaction_lock__"
201 /* the key used to store persistent db sequence number */
202 #define CTDB_DB_SEQNUM_KEY "__db_sequence_number__"
204 #define MONITOR_SCRIPT_OK 0
205 #define MONITOR_SCRIPT_TIMEOUT 1
207 #define MAX_SCRIPT_NAME 31
208 #define MAX_SCRIPT_OUTPUT 511
209 struct ctdb_script_wire {
210 char name[MAX_SCRIPT_NAME+1];
211 struct timeval start;
212 struct timeval finished;
213 int32_t status;
214 char output[MAX_SCRIPT_OUTPUT+1];
217 struct ctdb_scripts_wire {
218 uint32_t num_scripts;
219 struct ctdb_script_wire scripts[1];
222 /* different calls to event scripts. */
223 enum ctdb_eventscript_call {
224 CTDB_EVENT_INIT, /* CTDB starting up: no args */
225 CTDB_EVENT_SETUP, /* CTDB starting up after transport is readdy: no args. */
226 CTDB_EVENT_STARTUP, /* CTDB starting up after initial recovery: no args. */
227 CTDB_EVENT_START_RECOVERY, /* CTDB recovery starting: no args. */
228 CTDB_EVENT_RECOVERED, /* CTDB recovery finished: no args. */
229 CTDB_EVENT_TAKE_IP, /* IP taken: interface, IP address, netmask bits. */
230 CTDB_EVENT_RELEASE_IP, /* IP released: interface, IP address, netmask bits. */
231 CTDB_EVENT_STOPPED, /* This node is stopped: no args. */
232 CTDB_EVENT_MONITOR, /* Please check if service is healthy: no args. */
233 CTDB_EVENT_STATUS, /* Report service status: no args. */
234 CTDB_EVENT_SHUTDOWN, /* CTDB shutting down: no args. */
235 CTDB_EVENT_RELOAD, /* magic */
236 CTDB_EVENT_UPDATE_IP, /* IP updating: old interface, new interface, IP address, netmask bits. */
237 CTDB_EVENT_IPREALLOCATED, /* when a takeover_run() completes */
238 CTDB_EVENT_MAX
241 /* Mapping from enum to names. */
242 extern const char *ctdb_eventscript_call_names[];
245 operation IDs
247 enum ctdb_operation {
248 CTDB_REQ_CALL = 0,
249 CTDB_REPLY_CALL = 1,
250 CTDB_REQ_DMASTER = 2,
251 CTDB_REPLY_DMASTER = 3,
252 CTDB_REPLY_ERROR = 4,
253 CTDB_REQ_MESSAGE = 5,
254 /* #6 removed */
255 CTDB_REQ_CONTROL = 7,
256 CTDB_REPLY_CONTROL = 8,
257 CTDB_REQ_KEEPALIVE = 9,
260 #define CTDB_MAGIC 0x43544442 /* CTDB */
261 #define CTDB_VERSION 1
263 enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
264 CTDB_CONTROL_STATISTICS = 1,
265 /* #2 removed */
266 CTDB_CONTROL_PING = 3,
267 CTDB_CONTROL_GETDBPATH = 4,
268 CTDB_CONTROL_GETVNNMAP = 5,
269 CTDB_CONTROL_SETVNNMAP = 6,
270 CTDB_CONTROL_GET_DEBUG = 7,
271 CTDB_CONTROL_SET_DEBUG = 8,
272 CTDB_CONTROL_GET_DBMAP = 9,
273 CTDB_CONTROL_GET_NODEMAPv4 = 10, /* obsolete */
274 CTDB_CONTROL_SET_DMASTER = 11,
275 /* #12 removed */
276 CTDB_CONTROL_PULL_DB = 13,
277 CTDB_CONTROL_PUSH_DB = 14,
278 CTDB_CONTROL_GET_RECMODE = 15,
279 CTDB_CONTROL_SET_RECMODE = 16,
280 CTDB_CONTROL_STATISTICS_RESET = 17,
281 CTDB_CONTROL_DB_ATTACH = 18,
282 CTDB_CONTROL_SET_CALL = 19,
283 CTDB_CONTROL_TRAVERSE_START = 20,
284 CTDB_CONTROL_TRAVERSE_ALL = 21,
285 CTDB_CONTROL_TRAVERSE_DATA = 22,
286 CTDB_CONTROL_REGISTER_SRVID = 23,
287 CTDB_CONTROL_DEREGISTER_SRVID = 24,
288 CTDB_CONTROL_GET_DBNAME = 25,
289 CTDB_CONTROL_ENABLE_SEQNUM = 26,
290 CTDB_CONTROL_UPDATE_SEQNUM = 27,
291 /* #28 removed */
292 CTDB_CONTROL_DUMP_MEMORY = 29,
293 CTDB_CONTROL_GET_PID = 30,
294 CTDB_CONTROL_GET_RECMASTER = 31,
295 CTDB_CONTROL_SET_RECMASTER = 32,
296 CTDB_CONTROL_FREEZE = 33,
297 CTDB_CONTROL_THAW = 34,
298 CTDB_CONTROL_GET_PNN = 35,
299 CTDB_CONTROL_SHUTDOWN = 36,
300 CTDB_CONTROL_GET_MONMODE = 37,
301 /* #38 removed */
302 /* #39 removed */
303 /* #40 removed */
304 /* #41 removed */
305 CTDB_CONTROL_TAKEOVER_IPv4 = 42, /* obsolete */
306 CTDB_CONTROL_RELEASE_IPv4 = 43, /* obsolete */
307 CTDB_CONTROL_TCP_CLIENT = 44,
308 CTDB_CONTROL_TCP_ADD = 45,
309 CTDB_CONTROL_TCP_REMOVE = 46,
310 CTDB_CONTROL_STARTUP = 47,
311 CTDB_CONTROL_SET_TUNABLE = 48,
312 CTDB_CONTROL_GET_TUNABLE = 49,
313 CTDB_CONTROL_LIST_TUNABLES = 50,
314 CTDB_CONTROL_GET_PUBLIC_IPSv4 = 51, /* obsolete */
315 CTDB_CONTROL_MODIFY_FLAGS = 52,
316 CTDB_CONTROL_GET_ALL_TUNABLES = 53,
317 CTDB_CONTROL_KILL_TCP = 54,
318 CTDB_CONTROL_GET_TCP_TICKLE_LIST = 55,
319 CTDB_CONTROL_SET_TCP_TICKLE_LIST = 56,
320 CTDB_CONTROL_REGISTER_SERVER_ID = 57,
321 CTDB_CONTROL_UNREGISTER_SERVER_ID = 58,
322 CTDB_CONTROL_CHECK_SERVER_ID = 59,
323 CTDB_CONTROL_GET_SERVER_ID_LIST = 60,
324 CTDB_CONTROL_DB_ATTACH_PERSISTENT = 61,
325 CTDB_CONTROL_PERSISTENT_STORE = 62,
326 CTDB_CONTROL_UPDATE_RECORD = 63,
327 CTDB_CONTROL_SEND_GRATIOUS_ARP = 64,
328 CTDB_CONTROL_TRANSACTION_START = 65,
329 CTDB_CONTROL_TRANSACTION_COMMIT = 66,
330 CTDB_CONTROL_WIPE_DATABASE = 67,
331 /* #68 removed */
332 CTDB_CONTROL_UPTIME = 69,
333 CTDB_CONTROL_START_RECOVERY = 70,
334 CTDB_CONTROL_END_RECOVERY = 71,
335 CTDB_CONTROL_RELOAD_NODES_FILE = 72,
336 /* #73 removed */
337 CTDB_CONTROL_TRY_DELETE_RECORDS = 74,
338 CTDB_CONTROL_ENABLE_MONITOR = 75,
339 CTDB_CONTROL_DISABLE_MONITOR = 76,
340 CTDB_CONTROL_ADD_PUBLIC_IP = 77,
341 CTDB_CONTROL_DEL_PUBLIC_IP = 78,
342 CTDB_CONTROL_RUN_EVENTSCRIPTS = 79,
343 CTDB_CONTROL_GET_CAPABILITIES = 80,
344 CTDB_CONTROL_START_PERSISTENT_UPDATE = 81,
345 CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE= 82,
346 CTDB_CONTROL_TRANS2_COMMIT = 83,
347 CTDB_CONTROL_TRANS2_FINISHED = 84,
348 CTDB_CONTROL_TRANS2_ERROR = 85,
349 CTDB_CONTROL_TRANS2_COMMIT_RETRY = 86,
350 CTDB_CONTROL_RECD_PING = 87,
351 CTDB_CONTROL_RELEASE_IP = 88,
352 CTDB_CONTROL_TAKEOVER_IP = 89,
353 CTDB_CONTROL_GET_PUBLIC_IPS = 90,
354 CTDB_CONTROL_GET_NODEMAP = 91,
355 CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS = 96,
356 CTDB_CONTROL_TRAVERSE_KILL = 97,
357 CTDB_CONTROL_RECD_RECLOCK_LATENCY = 98,
358 CTDB_CONTROL_GET_RECLOCK_FILE = 99,
359 CTDB_CONTROL_SET_RECLOCK_FILE = 100,
360 CTDB_CONTROL_STOP_NODE = 101,
361 CTDB_CONTROL_CONTINUE_NODE = 102,
362 CTDB_CONTROL_SET_NATGWSTATE = 103,
363 CTDB_CONTROL_SET_LMASTERROLE = 104,
364 CTDB_CONTROL_SET_RECMASTERROLE = 105,
365 CTDB_CONTROL_ENABLE_SCRIPT = 107,
366 CTDB_CONTROL_DISABLE_SCRIPT = 108,
367 CTDB_CONTROL_SET_BAN_STATE = 109,
368 CTDB_CONTROL_GET_BAN_STATE = 110,
369 CTDB_CONTROL_SET_DB_PRIORITY = 111,
370 CTDB_CONTROL_GET_DB_PRIORITY = 112,
371 CTDB_CONTROL_TRANSACTION_CANCEL = 113,
372 CTDB_CONTROL_REGISTER_NOTIFY = 114,
373 CTDB_CONTROL_DEREGISTER_NOTIFY = 115,
374 CTDB_CONTROL_TRANS2_ACTIVE = 116,
375 CTDB_CONTROL_GET_LOG = 117,
376 CTDB_CONTROL_CLEAR_LOG = 118,
377 CTDB_CONTROL_TRANS3_COMMIT = 119,
378 CTDB_CONTROL_GET_DB_SEQNUM = 120,
379 CTDB_CONTROL_DB_SET_HEALTHY = 121,
380 CTDB_CONTROL_DB_GET_HEALTH = 122,
381 CTDB_CONTROL_GET_PUBLIC_IP_INFO = 123,
382 CTDB_CONTROL_GET_IFACES = 124,
383 CTDB_CONTROL_SET_IFACE_LINK_STATE = 125,
384 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE = 126,
385 CTDB_CONTROL_GET_STAT_HISTORY = 127,
386 CTDB_CONTROL_SCHEDULE_FOR_DELETION = 128,
387 CTDB_CONTROL_SET_DB_READONLY = 129,
388 CTDB_CONTROL_CHECK_SRVIDS = 130,
389 CTDB_CONTROL_TRAVERSE_START_EXT = 131,
390 CTDB_CONTROL_GET_DB_STATISTICS = 132,
391 CTDB_CONTROL_SET_DB_STICKY = 133,
392 CTDB_CONTROL_RELOAD_PUBLIC_IPS = 134,
396 packet structures
398 struct ctdb_req_header {
399 uint32_t length;
400 uint32_t ctdb_magic;
401 uint32_t ctdb_version;
402 uint32_t generation;
403 uint32_t operation;
404 uint32_t destnode;
405 uint32_t srcnode;
406 uint32_t reqid;
409 struct ctdb_req_call {
410 struct ctdb_req_header hdr;
411 uint32_t flags;
412 uint32_t db_id;
413 uint32_t callid;
414 uint32_t hopcount;
415 uint32_t keylen;
416 uint32_t calldatalen;
417 uint8_t data[1]; /* key[] followed by calldata[] */
420 struct ctdb_reply_call {
421 struct ctdb_req_header hdr;
422 uint32_t status;
423 uint32_t datalen;
424 uint8_t data[1];
427 struct ctdb_reply_error {
428 struct ctdb_req_header hdr;
429 uint32_t status;
430 uint32_t msglen;
431 uint8_t msg[1];
434 struct ctdb_req_dmaster {
435 struct ctdb_req_header hdr;
436 uint32_t db_id;
437 uint64_t rsn;
438 uint32_t dmaster;
439 uint32_t keylen;
440 uint32_t datalen;
441 uint8_t data[1];
444 struct ctdb_reply_dmaster {
445 struct ctdb_req_header hdr;
446 uint32_t db_id;
447 uint64_t rsn;
448 uint32_t keylen;
449 uint32_t datalen;
450 uint8_t data[1];
453 struct ctdb_req_message {
454 struct ctdb_req_header hdr;
455 uint64_t srvid;
456 uint32_t datalen;
457 uint8_t data[1];
460 struct ctdb_req_getdbpath {
461 struct ctdb_req_header hdr;
462 uint32_t db_id;
465 struct ctdb_reply_getdbpath {
466 struct ctdb_req_header hdr;
467 uint32_t datalen;
468 uint8_t data[1];
471 struct ctdb_req_control {
472 struct ctdb_req_header hdr;
473 uint32_t opcode;
474 uint32_t pad;
475 uint64_t srvid;
476 uint32_t client_id;
477 #define CTDB_CTRL_FLAG_NOREPLY 1
478 #define CTDB_CTRL_FLAG_OPCODE_SPECIFIC 0xFFFF0000
479 uint32_t flags;
480 uint32_t datalen;
481 uint8_t data[1];
484 struct ctdb_reply_control {
485 struct ctdb_req_header hdr;
486 int32_t status;
487 uint32_t datalen;
488 uint32_t errorlen;
489 uint8_t data[1];
492 struct ctdb_req_keepalive {
493 struct ctdb_req_header hdr;
497 /* types of failures possible from TRANS2_COMMIT */
498 enum ctdb_trans2_commit_error {
499 CTDB_TRANS2_COMMIT_SUCCESS=0, /* all nodes committed successfully */
500 CTDB_TRANS2_COMMIT_TIMEOUT=1, /* at least one node timed out */
501 CTDB_TRANS2_COMMIT_ALLFAIL=2, /* all nodes failed the commit */
502 CTDB_TRANS2_COMMIT_SOMEFAIL=3 /* some nodes failed the commit, some allowed it */
506 the extended header for records in the ltdb
508 struct ctdb_ltdb_header {
509 uint64_t rsn;
510 uint32_t dmaster;
511 uint16_t laccessor;
512 uint16_t lacount;
513 #define CTDB_REC_FLAG_DEFAULT 0x00000000
514 #define CTDB_REC_FLAG_MIGRATED_WITH_DATA 0x00010000
515 #define CTDB_REC_FLAG_VACUUM_MIGRATED 0x00020000
516 #define CTDB_REC_FLAG_AUTOMATIC 0x00040000
517 #define CTDB_REC_RO_HAVE_DELEGATIONS 0x01000000
518 #define CTDB_REC_RO_HAVE_READONLY 0x02000000
519 #define CTDB_REC_RO_REVOKING_READONLY 0x04000000
520 #define CTDB_REC_RO_REVOKE_COMPLETE 0x08000000
521 uint32_t flags;
526 definitions for different socket structures
528 typedef struct sockaddr_in ctdb_addr_in;
529 typedef struct sockaddr_in6 ctdb_addr_in6;
530 typedef union {
531 struct sockaddr sa;
532 ctdb_addr_in ip;
533 ctdb_addr_in6 ip6;
534 } ctdb_sock_addr;
537 A structure describing a single node, its flags and its address
539 struct ctdb_node_and_flags {
540 uint32_t pnn;
541 uint32_t flags;
542 ctdb_sock_addr addr;
547 Structure used for a nodemap.
548 The nodemap is the structure containing a list of all nodes
549 known to the cluster and their associated flags.
551 struct ctdb_node_map {
552 uint32_t num;
553 struct ctdb_node_and_flags nodes[1];
557 * Node flags
559 #define NODE_FLAGS_DISCONNECTED 0x00000001 /* node isn't connected */
560 #define NODE_FLAGS_UNHEALTHY 0x00000002 /* monitoring says node is unhealthy */
561 #define NODE_FLAGS_PERMANENTLY_DISABLED 0x00000004 /* administrator has disabled node */
562 #define NODE_FLAGS_BANNED 0x00000008 /* recovery daemon has banned the node */
563 #define NODE_FLAGS_DELETED 0x00000010 /* this node has been deleted */
564 #define NODE_FLAGS_STOPPED 0x00000020 /* this node has been stopped */
565 #define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
566 #define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
568 #define NODE_FLAGS_NOIPTAKEOVER 0x01000000 /* this node can takeover any new ip addresses, this flag is ONLY valid within the recovery daemon */
571 struct ctdb_public_ip {
572 uint32_t pnn;
573 ctdb_sock_addr addr;
576 struct ctdb_all_public_ips {
577 uint32_t num;
578 struct ctdb_public_ip ips[1];
582 struct latency_counter {
583 int num;
584 double min;
585 double max;
586 double total;
590 structure used to pass record data between the child and parent
592 struct ctdb_rec_data {
593 uint32_t length;
594 uint32_t reqid;
595 uint32_t keylen;
596 uint32_t datalen;
597 uint8_t data[1];
600 struct ctdb_traverse_start {
601 uint32_t db_id;
602 uint32_t reqid;
603 uint64_t srvid;
606 struct ctdb_traverse_start_ext {
607 uint32_t db_id;
608 uint32_t reqid;
609 uint64_t srvid;
610 bool withemptyrecords;
614 ctdb statistics information
616 #define MAX_COUNT_BUCKETS 16
617 #define MAX_HOT_KEYS 10
619 struct ctdb_statistics {
620 uint32_t num_clients;
621 uint32_t frozen;
622 uint32_t recovering;
623 uint32_t client_packets_sent;
624 uint32_t client_packets_recv;
625 uint32_t node_packets_sent;
626 uint32_t node_packets_recv;
627 uint32_t keepalive_packets_sent;
628 uint32_t keepalive_packets_recv;
629 struct {
630 uint32_t req_call;
631 uint32_t reply_call;
632 uint32_t req_dmaster;
633 uint32_t reply_dmaster;
634 uint32_t reply_error;
635 uint32_t req_message;
636 uint32_t req_control;
637 uint32_t reply_control;
638 } node;
639 struct {
640 uint32_t req_call;
641 uint32_t req_message;
642 uint32_t req_control;
643 } client;
644 struct {
645 uint32_t call;
646 uint32_t control;
647 uint32_t traverse;
648 } timeouts;
649 struct {
650 struct latency_counter ctdbd;
651 struct latency_counter recd;
652 } reclock;
653 uint32_t total_calls;
654 uint32_t pending_calls;
655 uint32_t lockwait_calls;
656 uint32_t pending_lockwait_calls;
657 uint32_t childwrite_calls;
658 uint32_t pending_childwrite_calls;
659 uint32_t memory_used;
660 uint32_t __last_counter; /* hack for control_statistics_all */
661 uint32_t max_hop_count;
662 uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
663 struct latency_counter call_latency;
664 struct latency_counter lockwait_latency;
665 struct latency_counter childwrite_latency;
666 uint32_t num_recoveries;
667 struct timeval statistics_start_time;
668 struct timeval statistics_current_time;
669 uint32_t total_ro_delegations;
670 uint32_t total_ro_revokes;
674 * wire format for statistics history
676 struct ctdb_statistics_wire {
677 uint32_t num;
678 struct ctdb_statistics stats[1];
682 * db statistics
684 struct ctdb_db_hot_key {
685 uint32_t count;
686 TDB_DATA key;
688 struct ctdb_db_statistics {
689 uint32_t db_ro_delegations;
690 uint32_t db_ro_revokes;
691 uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
692 uint32_t num_hot_keys;
693 struct ctdb_db_hot_key hot_keys[MAX_HOT_KEYS];
695 struct ctdb_db_statistics_wire {
696 uint32_t db_ro_delegations;
697 uint32_t db_ro_revokes;
698 uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
699 uint32_t num_hot_keys;
700 char hot_keys[1];
704 * wire format for interface list
706 #ifdef IFNAMSIZ
707 #define CTDB_IFACE_SIZE IFNAMSIZ
708 #else
709 #define CTDB_IFACE_SIZE 16
710 #endif
712 struct ctdb_iface_info {
713 char name[CTDB_IFACE_SIZE+2];
714 uint16_t link_state;
715 uint32_t references;
718 struct ctdb_ifaces_list {
719 uint32_t num;
720 struct ctdb_iface_info ifaces[1];
723 #define INVALID_GENERATION 1
724 /* table that contains the mapping between a hash value and lmaster
726 struct ctdb_vnn_map {
727 uint32_t generation;
728 uint32_t size;
729 uint32_t *map;
733 a wire representation of the vnn map
735 struct ctdb_vnn_map_wire {
736 uint32_t generation;
737 uint32_t size;
738 uint32_t map[1];
741 #endif