2 CTDB protocol marshalling
4 Copyright (C) Amitay Isaacs 2015
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__
25 #define CTDB_MAGIC 0x43544442 /* CTDB */
26 #define CTDB_PROTOCOL 1
32 CTDB_REPLY_DMASTER
= 3,
37 CTDB_REPLY_CONTROL
= 8,
38 CTDB_REQ_KEEPALIVE
= 9,
42 /* used on the domain socket, send a pdu to the local daemon */
43 #define CTDB_CURRENT_NODE 0xF0000001
44 /* send a broadcast to all nodes in the cluster, active or not */
45 #define CTDB_BROADCAST_ALL 0xF0000002
46 /* send a broadcast to all nodes in the current vnn map */
47 #define CTDB_BROADCAST_ACTIVE 0xF0000003
48 /* send a broadcast to all connected nodes */
49 #define CTDB_BROADCAST_CONNECTED 0xF0000004
50 /* send a broadcast to selected connected nodes */
51 #define CTDB_MULTICAST 0xF0000005
53 #define CTDB_UNKNOWN_PNN 0xFFFFFFFF
55 /* the key used to store persistent db sequence number */
56 #define CTDB_DB_SEQNUM_KEY "__db_sequence_number__"
58 struct ctdb_req_header
{
61 uint32_t ctdb_version
;
69 struct ctdb_req_call
{
78 struct ctdb_reply_call
{
83 struct ctdb_reply_error
{
88 struct ctdb_req_dmaster
{
96 struct ctdb_reply_dmaster
{
103 #define CTDB_NULL_FUNC 0xFF000001
104 #define CTDB_FETCH_FUNC 0xFF000002
105 #define CTDB_FETCH_WITH_HEADER_FUNC 0xFF000003
113 #define CTDB_IMMEDIATE_MIGRATION 0x00000001
114 #define CTDB_CALL_FLAG_VACUUM_MIGRATION 0x00000002
115 #define CTDB_WANT_READONLY 0x00000004
119 /* SRVID to catch all messages */
120 #define CTDB_SRVID_ALL (~(uint64_t)0)
122 /* SRVID prefix used during recovery for pulling and pushing databases */
123 #define CTDB_SRVID_RECOVERY 0xF001000000000000LL
125 /* SRVID to assign of banning credits */
126 #define CTDB_SRVID_BANNING 0xF002000000000000LL
128 /* SRVID to inform of election data */
129 #define CTDB_SRVID_ELECTION 0xF100000000000000LL
131 /* SRVID for broadcasting leader */
132 #define CTDB_SRVID_LEADER 0xF101000000000000LL
134 /* SRVID to inform clients that the cluster has been reconfigured */
135 #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
137 /* SRVID to inform clients an IP address has been released */
138 #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
140 /* SRVID to inform clients that an IP address has been taken over */
141 #define CTDB_SRVID_TAKE_IP 0xF301000000000000LL
143 /* SRVID to inform clients that CTDB_EVENT_IPREALLOCATED finished */
144 #define CTDB_SRVID_IPREALLOCATED 0xF302000000000000LL
146 /* SRVID to inform clients that CTDB_EVENT_START_IPREALLOCATE finished */
147 #define CTDB_SRVID_START_IPREALLOCATE 0xF303000000000000LL
149 /* SRVID to inform recovery daemon of the node flags - OBSOLETE */
150 #define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
152 /* SRVID to inform recovery daemon to update public ip assignment */
153 #define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
155 /* SRVID to inform recovery daemon to migrate a set of records */
156 #define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
158 /* SRVID to inform recovery daemon to detach a database */
159 #define CTDB_SRVID_DETACH_DATABASE 0xF701000000000000LL
161 /* SRVID to inform recovery daemon to dump talloc memdump to the log */
162 #define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
164 /* SRVID to inform recovery daemon to send logs */
165 #define CTDB_SRVID_GETLOG 0xF801000000000000LL
167 /* SRVID to inform recovery daemon to clear logs */
168 #define CTDB_SRVID_CLEARLOG 0xF802000000000000LL
170 /* SRVID to inform recovery daemon to push the node flags to other nodes */
171 #define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
173 /* SRVID to inform recovery daemon to reload the nodes file */
174 #define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
176 /* SRVID to inform recovery daemon to perform a takeover run */
177 #define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
179 /* SRVID to inform recovery daemon to rebalance ips for a node. */
180 #define CTDB_SRVID_REBALANCE_NODE 0xFB01000000000000LL
182 /* SRVID to inform recovery daemon to stop takeover runs from occurring */
183 #define CTDB_SRVID_DISABLE_TAKEOVER_RUNS 0xFB03000000000000LL
185 /* SRVID to inform recovery daemon to stop recoveries from occurring */
186 #define CTDB_SRVID_DISABLE_RECOVERIES 0xFB04000000000000LL
188 /* SRVID to inform recovery daemon to disable the public ip checks */
189 #define CTDB_SRVID_DISABLE_IP_CHECK 0xFC00000000000000LL
191 /* A range of ports reserved for registering a PID (top 8 bits)
192 * All ports matching the 8 top bits are reserved for exclusive use by
193 * registering a SRVID that matches the process-id of the requesting process
195 #define CTDB_SRVID_PID_RANGE 0x0000000000000000LL
197 /* A range of ports reserved for samba (top 8 bits)
198 * All ports matching the 8 top bits are reserved for exclusive use by
201 #define CTDB_SRVID_SAMBA_NOTIFY 0xFE00000000000000LL
202 #define CTDB_SRVID_SAMBA_RANGE 0xFE00000000000000LL
204 /* A range of ports reserved for a CTDB NFS server (top 8 bits)
205 * All ports matching the 8 top bits are reserved for exclusive use by
208 #define CTDB_SRVID_NFSD_RANGE 0xEE00000000000000LL
210 /* A range of ports reserved for a CTDB ISCSI server (top 8 bits)
211 * All ports matching the 8 top bits are reserved for exclusive use by
214 #define CTDB_SRVID_ISCSID_RANGE 0xDE00000000000000LL
216 /* A range of ports reserved for CTDB tool (top 8 bits)
217 * All ports matching the 8 top bits are reserved for exclusive use by
220 #define CTDB_SRVID_TOOL_RANGE 0xCE00000000000000LL
222 /* A range of ports reserved by client (top 8 bits)
223 * All ports matching the 8 top bits are reserved for exclusive use by
226 #define CTDB_SRVID_CLIENT_RANGE 0xBE00000000000000LL
228 /* Range of ports reserved for test applications (top 8 bits)
229 * All ports matching the 8 top bits are reserved for exclusive use by
232 #define CTDB_SRVID_TEST_RANGE 0xAE00000000000000LL
235 enum ctdb_controls
{CTDB_CONTROL_PROCESS_EXISTS
= 0,
236 CTDB_CONTROL_STATISTICS
= 1,
238 CTDB_CONTROL_PING
= 3,
239 CTDB_CONTROL_GETDBPATH
= 4,
240 CTDB_CONTROL_GETVNNMAP
= 5,
241 CTDB_CONTROL_SETVNNMAP
= 6,
242 CTDB_CONTROL_GET_DEBUG
= 7,
243 CTDB_CONTROL_SET_DEBUG
= 8,
244 CTDB_CONTROL_GET_DBMAP
= 9,
245 CTDB_CONTROL_GET_NODEMAPv4
= 10, /* obsolete */
246 CTDB_CONTROL_SET_DMASTER
= 11, /* obsolete */
248 CTDB_CONTROL_PULL_DB
= 13, /* obsolete */
249 CTDB_CONTROL_PUSH_DB
= 14, /* obsolete */
250 CTDB_CONTROL_GET_RECMODE
= 15,
251 CTDB_CONTROL_SET_RECMODE
= 16,
252 CTDB_CONTROL_STATISTICS_RESET
= 17,
253 CTDB_CONTROL_DB_ATTACH
= 18,
254 CTDB_CONTROL_SET_CALL
= 19, /* obsolete */
255 CTDB_CONTROL_TRAVERSE_START
= 20,
256 CTDB_CONTROL_TRAVERSE_ALL
= 21,
257 CTDB_CONTROL_TRAVERSE_DATA
= 22,
258 CTDB_CONTROL_REGISTER_SRVID
= 23,
259 CTDB_CONTROL_DEREGISTER_SRVID
= 24,
260 CTDB_CONTROL_GET_DBNAME
= 25,
261 CTDB_CONTROL_ENABLE_SEQNUM
= 26,
262 CTDB_CONTROL_UPDATE_SEQNUM
= 27,
264 CTDB_CONTROL_DUMP_MEMORY
= 29,
265 CTDB_CONTROL_GET_PID
= 30,
266 CTDB_CONTROL_GET_RECMASTER
= 31, /* obsolete */
267 CTDB_CONTROL_SET_RECMASTER
= 32, /* obsolete */
268 CTDB_CONTROL_FREEZE
= 33,
269 CTDB_CONTROL_THAW
= 34, /* obsolete */
270 CTDB_CONTROL_GET_PNN
= 35,
271 CTDB_CONTROL_SHUTDOWN
= 36,
272 CTDB_CONTROL_GET_MONMODE
= 37, /* obsolete */
277 CTDB_CONTROL_TAKEOVER_IPv4
= 42, /* obsolete */
278 CTDB_CONTROL_RELEASE_IPv4
= 43, /* obsolete */
279 CTDB_CONTROL_TCP_CLIENT
= 44,
280 CTDB_CONTROL_TCP_ADD
= 45,
281 CTDB_CONTROL_TCP_REMOVE
= 46,
282 CTDB_CONTROL_STARTUP
= 47,
283 CTDB_CONTROL_SET_TUNABLE
= 48,
284 CTDB_CONTROL_GET_TUNABLE
= 49,
285 CTDB_CONTROL_LIST_TUNABLES
= 50,
286 CTDB_CONTROL_GET_PUBLIC_IPSv4
= 51, /* obsolete */
287 CTDB_CONTROL_MODIFY_FLAGS
= 52,
288 CTDB_CONTROL_GET_ALL_TUNABLES
= 53,
289 CTDB_CONTROL_KILL_TCP
= 54, /* obsolete */
290 CTDB_CONTROL_GET_TCP_TICKLE_LIST
= 55,
291 CTDB_CONTROL_SET_TCP_TICKLE_LIST
= 56,
292 CTDB_CONTROL_REGISTER_SERVER_ID
= 57, /* obsolete */
293 CTDB_CONTROL_UNREGISTER_SERVER_ID
= 58, /* obsolete */
294 CTDB_CONTROL_CHECK_SERVER_ID
= 59, /* obsolete */
295 CTDB_CONTROL_GET_SERVER_ID_LIST
= 60, /* obsolete */
296 CTDB_CONTROL_DB_ATTACH_PERSISTENT
= 61,
297 CTDB_CONTROL_PERSISTENT_STORE
= 62, /* obsolete */
298 CTDB_CONTROL_UPDATE_RECORD
= 63,
299 CTDB_CONTROL_SEND_GRATUITOUS_ARP
= 64,
300 CTDB_CONTROL_TRANSACTION_START
= 65, /* obsolete */
301 CTDB_CONTROL_TRANSACTION_COMMIT
= 66, /* obsolete */
302 CTDB_CONTROL_WIPE_DATABASE
= 67,
304 CTDB_CONTROL_UPTIME
= 69,
305 CTDB_CONTROL_START_RECOVERY
= 70,
306 CTDB_CONTROL_END_RECOVERY
= 71,
307 CTDB_CONTROL_RELOAD_NODES_FILE
= 72,
309 CTDB_CONTROL_TRY_DELETE_RECORDS
= 74,
310 CTDB_CONTROL_ENABLE_MONITOR
= 75, /* obsolete */
311 CTDB_CONTROL_DISABLE_MONITOR
= 76, /* obsolete */
312 CTDB_CONTROL_ADD_PUBLIC_IP
= 77,
313 CTDB_CONTROL_DEL_PUBLIC_IP
= 78,
314 CTDB_CONTROL_RUN_EVENTSCRIPTS
= 79, /* obsolete */
315 CTDB_CONTROL_GET_CAPABILITIES
= 80,
316 CTDB_CONTROL_START_PERSISTENT_UPDATE
= 81, /* obsolete */
317 CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE
= 82, /* obsolete */
318 CTDB_CONTROL_TRANS2_COMMIT
= 83, /* obsolete */
319 CTDB_CONTROL_TRANS2_FINISHED
= 84, /* obsolete */
320 CTDB_CONTROL_TRANS2_ERROR
= 85, /* obsolete */
321 CTDB_CONTROL_TRANS2_COMMIT_RETRY
= 86, /* obsolete */
322 CTDB_CONTROL_RECD_PING
= 87,
323 CTDB_CONTROL_RELEASE_IP
= 88,
324 CTDB_CONTROL_TAKEOVER_IP
= 89,
325 CTDB_CONTROL_GET_PUBLIC_IPS
= 90,
326 CTDB_CONTROL_GET_NODEMAP
= 91,
328 CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS
= 96, /* obsolete */
329 CTDB_CONTROL_TRAVERSE_KILL
= 97,
330 CTDB_CONTROL_RECD_RECLOCK_LATENCY
= 98,
331 CTDB_CONTROL_GET_RECLOCK_FILE
= 99,
332 CTDB_CONTROL_SET_RECLOCK_FILE
= 100, /* obsolete */
333 CTDB_CONTROL_STOP_NODE
= 101,
334 CTDB_CONTROL_CONTINUE_NODE
= 102,
335 CTDB_CONTROL_SET_NATGWSTATE
= 103, /* obsolete */
336 CTDB_CONTROL_SET_LMASTERROLE
= 104,
337 CTDB_CONTROL_SET_RECMASTERROLE
= 105,
338 CTDB_CONTROL_ENABLE_SCRIPT
= 107, /* obsolete */
339 CTDB_CONTROL_DISABLE_SCRIPT
= 108, /* obsolete */
340 CTDB_CONTROL_SET_BAN_STATE
= 109,
341 CTDB_CONTROL_GET_BAN_STATE
= 110,
342 CTDB_CONTROL_SET_DB_PRIORITY
= 111, /* obsolete */
343 CTDB_CONTROL_GET_DB_PRIORITY
= 112, /* obsolete */
344 CTDB_CONTROL_TRANSACTION_CANCEL
= 113, /* obsolete */
345 CTDB_CONTROL_REGISTER_NOTIFY
= 114,
346 CTDB_CONTROL_DEREGISTER_NOTIFY
= 115,
347 CTDB_CONTROL_TRANS2_ACTIVE
= 116, /* obsolete */
348 CTDB_CONTROL_GET_LOG
= 117, /* obsolete */
349 CTDB_CONTROL_CLEAR_LOG
= 118, /* obsolete */
350 CTDB_CONTROL_TRANS3_COMMIT
= 119,
351 CTDB_CONTROL_GET_DB_SEQNUM
= 120,
352 CTDB_CONTROL_DB_SET_HEALTHY
= 121,
353 CTDB_CONTROL_DB_GET_HEALTH
= 122,
354 CTDB_CONTROL_GET_PUBLIC_IP_INFO
= 123,
355 CTDB_CONTROL_GET_IFACES
= 124,
356 CTDB_CONTROL_SET_IFACE_LINK_STATE
= 125,
357 CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE
= 126,
358 CTDB_CONTROL_GET_STAT_HISTORY
= 127,
359 CTDB_CONTROL_SCHEDULE_FOR_DELETION
= 128,
360 CTDB_CONTROL_SET_DB_READONLY
= 129,
361 CTDB_CONTROL_CHECK_SRVIDS
= 130, /* obsolete */
362 CTDB_CONTROL_TRAVERSE_START_EXT
= 131,
363 CTDB_CONTROL_GET_DB_STATISTICS
= 132,
364 CTDB_CONTROL_SET_DB_STICKY
= 133,
365 CTDB_CONTROL_RELOAD_PUBLIC_IPS
= 134,
366 CTDB_CONTROL_TRAVERSE_ALL_EXT
= 135,
367 CTDB_CONTROL_RECEIVE_RECORDS
= 136, /* obsolete */
368 CTDB_CONTROL_IPREALLOCATED
= 137,
369 CTDB_CONTROL_GET_RUNSTATE
= 138,
370 CTDB_CONTROL_DB_DETACH
= 139,
371 CTDB_CONTROL_GET_NODES_FILE
= 140,
372 CTDB_CONTROL_DB_FREEZE
= 141,
373 CTDB_CONTROL_DB_THAW
= 142,
374 CTDB_CONTROL_DB_TRANSACTION_START
= 143,
375 CTDB_CONTROL_DB_TRANSACTION_COMMIT
= 144,
376 CTDB_CONTROL_DB_TRANSACTION_CANCEL
= 145,
377 CTDB_CONTROL_DB_PULL
= 146,
378 CTDB_CONTROL_DB_PUSH_START
= 147,
379 CTDB_CONTROL_DB_PUSH_CONFIRM
= 148,
380 CTDB_CONTROL_DB_OPEN_FLAGS
= 149,
381 CTDB_CONTROL_DB_ATTACH_REPLICATED
= 150,
382 CTDB_CONTROL_CHECK_PID_SRVID
= 151,
383 CTDB_CONTROL_TUNNEL_REGISTER
= 152,
384 CTDB_CONTROL_TUNNEL_DEREGISTER
= 153,
385 CTDB_CONTROL_VACUUM_FETCH
= 154,
386 CTDB_CONTROL_DB_VACUUM
= 155,
387 CTDB_CONTROL_ECHO_DATA
= 156,
388 CTDB_CONTROL_DISABLE_NODE
= 157,
389 CTDB_CONTROL_ENABLE_NODE
= 158,
390 CTDB_CONTROL_TCP_CLIENT_DISCONNECTED
= 159,
391 CTDB_CONTROL_TCP_CLIENT_PASSED
= 160,
392 CTDB_CONTROL_START_IPREALLOCATE
= 161,
395 #define MAX_COUNT_BUCKETS 16
396 #define MAX_HOT_KEYS 10
398 struct ctdb_latency_counter
{
405 struct ctdb_statistics
{
406 uint32_t num_clients
;
409 uint32_t client_packets_sent
;
410 uint32_t client_packets_recv
;
411 uint32_t node_packets_sent
;
412 uint32_t node_packets_recv
;
413 uint32_t keepalive_packets_sent
;
414 uint32_t keepalive_packets_recv
;
418 uint32_t req_dmaster
;
419 uint32_t reply_dmaster
;
420 uint32_t reply_error
;
421 uint32_t req_message
;
422 uint32_t req_control
;
423 uint32_t reply_control
;
428 uint32_t req_message
;
429 uint32_t req_control
;
438 struct ctdb_latency_counter ctdbd
;
439 struct ctdb_latency_counter recd
;
443 uint32_t num_current
;
444 uint32_t num_pending
;
446 struct ctdb_latency_counter latency
;
447 uint32_t buckets
[MAX_COUNT_BUCKETS
];
449 uint32_t total_calls
;
450 uint32_t pending_calls
;
451 uint32_t childwrite_calls
;
452 uint32_t pending_childwrite_calls
;
453 uint32_t memory_used
;
454 uint32_t __last_counter
; /* hack */
455 uint32_t max_hop_count
;
456 uint32_t hop_count_bucket
[MAX_COUNT_BUCKETS
];
457 struct ctdb_latency_counter call_latency
;
458 struct ctdb_latency_counter childwrite_latency
;
459 uint32_t num_recoveries
;
460 struct timeval statistics_start_time
;
461 struct timeval statistics_current_time
;
462 uint32_t total_ro_delegations
;
463 uint32_t total_ro_revokes
;
466 #define INVALID_GENERATION 1
467 /* table that contains the mapping between a hash value and lmaster
469 struct ctdb_vnn_map
{
477 #define CTDB_DB_FLAGS_PERSISTENT 0x01
478 #define CTDB_DB_FLAGS_READONLY 0x02
479 #define CTDB_DB_FLAGS_STICKY 0x04
480 #define CTDB_DB_FLAGS_REPLICATED 0x08
484 struct ctdb_dbid_map
{
486 struct ctdb_dbid
*dbs
;
491 #define CTDB_LMASTER_ANY 0xffffffff
495 struct ctdb_pulldb_ext
{
501 #define CTDB_RECOVERY_NORMAL 0
502 #define CTDB_RECOVERY_ACTIVE 1
505 the extended header for records in the ltdb
507 struct ctdb_ltdb_header
{
511 #define CTDB_REC_FLAG_DEFAULT 0x00000000
512 #define CTDB_REC_FLAG_MIGRATED_WITH_DATA 0x00010000
513 #define CTDB_REC_FLAG_VACUUM_MIGRATED 0x00020000
514 #define CTDB_REC_FLAG_AUTOMATIC 0x00040000
515 #define CTDB_REC_RO_HAVE_DELEGATIONS 0x01000000
516 #define CTDB_REC_RO_HAVE_READONLY 0x02000000
517 #define CTDB_REC_RO_REVOKING_READONLY 0x04000000
518 #define CTDB_REC_RO_REVOKE_COMPLETE 0x08000000
519 #define CTDB_REC_RO_FLAGS (CTDB_REC_RO_HAVE_DELEGATIONS|\
520 CTDB_REC_RO_HAVE_READONLY|\
521 CTDB_REC_RO_REVOKING_READONLY|\
522 CTDB_REC_RO_REVOKE_COMPLETE)
526 struct ctdb_rec_data
{
528 struct ctdb_ltdb_header
*header
;
532 struct ctdb_rec_buffer
{
539 typedef int (*ctdb_rec_parser_func_t
)(uint32_t reqid
,
540 struct ctdb_ltdb_header
*header
,
541 TDB_DATA key
, TDB_DATA data
,
544 struct ctdb_traverse_start
{
550 struct ctdb_traverse_all
{
554 uint32_t client_reqid
;
558 struct ctdb_traverse_start_ext
{
562 bool withemptyrecords
;
565 struct ctdb_traverse_all_ext
{
569 uint32_t client_reqid
;
571 bool withemptyrecords
;
576 struct sockaddr_in ip
;
577 struct sockaddr_in6 ip6
;
580 struct ctdb_connection
{
583 ctdb_sock_addr server
;
587 ctdb_sock_addr client
;
591 struct ctdb_connection_list
{
593 struct ctdb_connection
*conn
;
596 struct ctdb_tunable
{
601 struct ctdb_var_list
{
606 struct ctdb_node_flag_change
{
612 /* all tunable variables go in here */
613 struct ctdb_tunable_list
{
614 uint32_t max_redirect_count
;
615 uint32_t seqnum_interval
; /* unit is ms */
616 uint32_t control_timeout
;
617 uint32_t traverse_timeout
;
618 uint32_t keepalive_interval
;
619 uint32_t keepalive_limit
;
620 uint32_t recover_timeout
;
621 uint32_t recover_interval
;
622 uint32_t election_timeout
;
623 uint32_t takeover_timeout
;
624 uint32_t monitor_interval
;
625 uint32_t tickle_update_interval
;
626 uint32_t script_timeout
;
627 uint32_t monitor_timeout_count
; /* allow dodgy scripts to hang this many times in a row before we mark the node unhealthy */
628 uint32_t script_unhealthy_on_timeout
; /* obsolete */
629 uint32_t recovery_grace_period
;
630 uint32_t recovery_ban_period
;
631 uint32_t database_hash_size
;
632 uint32_t database_max_dead
;
633 uint32_t rerecovery_timeout
;
634 uint32_t enable_bans
;
635 uint32_t deterministic_public_ips
;
636 uint32_t reclock_ping_period
;
637 uint32_t no_ip_failback
;
638 uint32_t disable_ip_failover
;
639 uint32_t verbose_memory_names
;
640 uint32_t recd_ping_timeout
;
641 uint32_t recd_ping_failcount
;
642 uint32_t log_latency_ms
;
643 uint32_t reclock_latency_ms
;
644 uint32_t recovery_drop_all_ips
;
645 uint32_t verify_recovery_lock
;
646 uint32_t vacuum_interval
;
647 uint32_t vacuum_max_run_time
;
648 uint32_t repack_limit
;
649 uint32_t vacuum_limit
;
650 uint32_t max_queue_depth_drop_msg
;
651 uint32_t allow_unhealthy_db_read
;
652 uint32_t stat_history_interval
;
653 uint32_t deferred_attach_timeout
;
654 uint32_t vacuum_fast_path_count
;
655 uint32_t lcp2_public_ip_assignment
;
656 uint32_t allow_client_db_attach
;
657 uint32_t recover_pdb_by_seqnum
;
658 uint32_t deferred_rebalance_on_node_add
;
659 uint32_t fetch_collapse
;
660 uint32_t hopcount_make_sticky
;
661 uint32_t sticky_duration
;
662 uint32_t sticky_pindown
;
663 uint32_t no_ip_takeover
;
664 uint32_t db_record_count_warn
;
665 uint32_t db_record_size_warn
;
666 uint32_t db_size_warn
;
667 uint32_t pulldb_preallocation_size
;
668 uint32_t no_ip_host_on_all_disabled
;
669 uint32_t samba3_hack
;
670 uint32_t mutex_enabled
;
671 uint32_t lock_processes_per_db
;
672 uint32_t rec_buffer_size_limit
;
673 uint32_t queue_buffer_size
;
674 uint32_t ip_alloc_algorithm
;
675 uint32_t allow_mixed_versions
;
678 struct ctdb_tickle_list
{
681 struct ctdb_connection
*conn
;
684 struct ctdb_addr_info
{
690 struct ctdb_transdb
{
696 struct timeval current_time
;
697 struct timeval ctdbd_start_time
;
698 struct timeval last_recovery_started
;
699 struct timeval last_recovery_finished
;
702 struct ctdb_public_ip
{
707 struct ctdb_public_ip_list
{
709 struct ctdb_public_ip
*ip
;
715 #define NODE_FLAGS_DISCONNECTED 0x00000001 /* node isn't connected */
716 #define NODE_FLAGS_UNHEALTHY 0x00000002 /* monitoring says node is unhealthy */
717 #define NODE_FLAGS_PERMANENTLY_DISABLED 0x00000004 /* administrator has disabled node */
718 #define NODE_FLAGS_BANNED 0x00000008 /* recovery daemon has banned the node */
719 #define NODE_FLAGS_DELETED 0x00000010 /* this node has been deleted */
720 #define NODE_FLAGS_STOPPED 0x00000020 /* this node has been stopped */
721 #define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
722 #define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
727 #define CTDB_CAP_RECMASTER 0x00000001
728 #define CTDB_CAP_LMASTER 0x00000002
729 #define CTDB_CAP_LVS 0x00000004 /* obsolete */
730 #define CTDB_CAP_NATGW 0x00000008 /* obsolete */
735 #define CTDB_CAP_PARALLEL_RECOVERY 0x00010000
736 #define CTDB_CAP_FRAGMENTED_CONTROLS 0x00020000
738 #define CTDB_CAP_FEATURES (CTDB_CAP_PARALLEL_RECOVERY | \
739 CTDB_CAP_FRAGMENTED_CONTROLS)
741 #define CTDB_CAP_DEFAULT (CTDB_CAP_RECMASTER | \
745 struct ctdb_node_and_flags
{
751 struct ctdb_node_map
{
753 struct ctdb_node_and_flags
*node
;
757 CTDB_EVENT_INIT
, /* CTDB starting up: no args */
758 CTDB_EVENT_SETUP
, /* CTDB starting up after transport is readdy: no args. */
759 CTDB_EVENT_STARTUP
, /* CTDB starting up after initial recovery: no args. */
760 CTDB_EVENT_START_RECOVERY
, /* CTDB recovery starting: no args. */
761 CTDB_EVENT_RECOVERED
, /* CTDB recovery finished: no args. */
762 CTDB_EVENT_TAKE_IP
, /* IP taken: interface, IP address, netmask bits. */
763 CTDB_EVENT_RELEASE_IP
, /* IP released: interface, IP address, netmask bits. */
764 CTDB_EVENT_STOPPED
, /* Deprecated, do not use. */
765 CTDB_EVENT_MONITOR
, /* Please check if service is healthy: no args. */
766 CTDB_EVENT_STATUS
, /* Deprecated, do not use. */
767 CTDB_EVENT_SHUTDOWN
, /* CTDB shutting down: no args. */
768 CTDB_EVENT_RELOAD
, /* Deprecated, do not use */
769 CTDB_EVENT_UPDATE_IP
, /* IP updating: old interface, new interface, IP address, netmask bits. */
770 CTDB_EVENT_IPREALLOCATED
, /* when a takeover_run() completes */
771 CTDB_EVENT_START_IPREALLOCATE
, /* When a takeover_run() starts */
775 #define MAX_SCRIPT_NAME 31
776 #define MAX_SCRIPT_OUTPUT 511
779 char name
[MAX_SCRIPT_NAME
+1];
780 struct timeval start
;
781 struct timeval finished
;
783 char output
[MAX_SCRIPT_OUTPUT
+1];
786 struct ctdb_script_list
{
787 uint32_t num_scripts
;
788 struct ctdb_script
*script
;
791 struct ctdb_ban_state
{
796 struct ctdb_notify_data
{
802 #define CTDB_IFACE_SIZE IFNAMSIZ
804 #define CTDB_IFACE_SIZE 16
808 char name
[CTDB_IFACE_SIZE
+2];
813 struct ctdb_iface_list
{
815 struct ctdb_iface
*iface
;
818 struct ctdb_public_ip_info
{
819 struct ctdb_public_ip ip
;
821 struct ctdb_iface_list
*ifaces
;
824 struct ctdb_statistics_list
{
826 struct ctdb_statistics
*stats
;
829 struct ctdb_key_data
{
831 struct ctdb_ltdb_header header
;
835 struct ctdb_db_statistics
{
838 uint32_t num_current
;
839 uint32_t num_pending
;
841 struct ctdb_latency_counter latency
;
842 uint32_t buckets
[MAX_COUNT_BUCKETS
];
845 struct ctdb_latency_counter latency
;
847 uint32_t db_ro_delegations
;
848 uint32_t db_ro_revokes
;
849 uint32_t hop_count_bucket
[MAX_COUNT_BUCKETS
];
850 uint32_t num_hot_keys
;
854 } hot_keys
[MAX_HOT_KEYS
];
858 CTDB_RUNSTATE_UNKNOWN
,
861 CTDB_RUNSTATE_FIRST_RECOVERY
,
862 CTDB_RUNSTATE_STARTUP
,
863 CTDB_RUNSTATE_RUNNING
,
864 CTDB_RUNSTATE_SHUTDOWN
,
867 struct ctdb_pid_srvid
{
872 struct ctdb_db_vacuum
{
874 bool full_vacuum_run
;
878 struct ctdb_echo_data
{
883 struct ctdb_req_control_data
{
888 struct ctdb_vnn_map
*vnnmap
;
890 struct ctdb_pulldb
*pulldb
;
891 struct ctdb_pulldb_ext
*pulldb_ext
;
892 struct ctdb_rec_buffer
*recbuf
;
895 struct ctdb_traverse_start
*traverse_start
;
896 struct ctdb_traverse_all
*traverse_all
;
897 struct ctdb_rec_data
*rec_data
;
899 struct ctdb_connection
*conn
;
900 struct ctdb_tunable
*tunable
;
902 struct ctdb_node_flag_change
*flag_change
;
903 ctdb_sock_addr
*addr
;
904 struct ctdb_tickle_list
*tickles
;
905 struct ctdb_client_id
*cid
;
906 struct ctdb_addr_info
*addr_info
;
907 struct ctdb_transdb
*transdb
;
908 struct ctdb_public_ip
*pubip
;
909 enum ctdb_event event
;
910 double reclock_latency
;
912 struct ctdb_ban_state
*ban_state
;
913 struct ctdb_notify_data
*notify
;
915 struct ctdb_iface
*iface
;
916 struct ctdb_key_data
*key
;
917 struct ctdb_traverse_start_ext
*traverse_start_ext
;
918 struct ctdb_traverse_all_ext
*traverse_all_ext
;
919 struct ctdb_pid_srvid
*pid_srvid
;
920 struct ctdb_db_vacuum
*db_vacuum
;
921 struct ctdb_echo_data
*echo_data
;
925 struct ctdb_reply_control_data
{
928 struct ctdb_statistics
*stats
;
930 struct ctdb_vnn_map
*vnnmap
;
932 struct ctdb_dbid_map
*dbmap
;
933 struct ctdb_rec_buffer
*recbuf
;
938 struct ctdb_var_list
*tun_var_list
;
939 struct ctdb_tunable_list
*tun_list
;
940 struct ctdb_tickle_list
*tickles
;
941 struct ctdb_client_id_map
*cid_map
;
942 struct ctdb_uptime
*uptime
;
944 struct ctdb_public_ip_list
*pubip_list
;
945 struct ctdb_node_map
*nodemap
;
946 const char *reclock_file
;
947 struct ctdb_ban_state
*ban_state
;
950 struct ctdb_public_ip_info
*ipinfo
;
951 struct ctdb_iface_list
*iface_list
;
952 struct ctdb_statistics_list
*stats_list
;
953 struct ctdb_db_statistics
*dbstats
;
954 enum ctdb_runstate runstate
;
955 uint32_t num_records
;
957 struct ctdb_echo_data
*echo_data
;
961 struct ctdb_req_control
{
966 #define CTDB_CTRL_FLAG_NOREPLY 1
967 #define CTDB_CTRL_FLAG_OPCODE_SPECIFIC 0xFFFF0000
968 /* Ugly overloading of this field... */
969 #define CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE 0x00010000
970 #define CTDB_CTRL_FLAG_ATTACH_RECOVERY 0x00020000
972 struct ctdb_req_control_data rdata
;
975 struct ctdb_reply_control
{
978 struct ctdb_reply_control_data rdata
;
981 struct ctdb_election_message
{
982 uint32_t num_connected
;
983 struct timeval priority_time
;
988 struct ctdb_srvid_message
{
993 struct ctdb_disable_message
{
999 union ctdb_message_data
{
1000 /* SRVID_ELECTION */
1001 struct ctdb_election_message
*election
;
1002 /* SRVID_RELEASE_IP, SRVID_TAKE_IP */
1004 /* SRVID_SET_NODE_FLAGS, SERVID_PUSH_NODE_FLAGS */
1005 struct ctdb_node_flag_change
*flag_change
;
1006 /* SRVID_RECD_UPDATE_IP */
1007 struct ctdb_public_ip
*pubip
;
1008 /* SRVID_VACUUM_FETCH */
1009 struct ctdb_rec_buffer
*recbuf
;
1010 /* SRVID_DETACH_DATABASE */
1012 /* SRVID_MEM_DUMP, SRVID_TAKEOVER_RUN */
1013 struct ctdb_srvid_message
*msg
;
1014 /* SRVID_BANNING, SRVID_REBALANCE_NODE, SRVID_LEADER */
1016 /* SRVID_DISABLE_TAKEOVER_RUNS, SRVID_DISABLE_RECOVERIES */
1017 struct ctdb_disable_message
*disable
;
1018 /* SRVID_DISABLE_IP_CHECK */
1024 struct ctdb_req_message
{
1026 union ctdb_message_data data
;
1029 struct ctdb_req_message_data
{
1034 struct ctdb_req_keepalive
{
1039 #define CTDB_TUNNEL_TEST 0xffffffff00000000
1041 #define CTDB_TUNNEL_FLAG_REQUEST 0x00000001
1042 #define CTDB_TUNNEL_FLAG_REPLY 0x00000002
1043 #define CTDB_TUNNEL_FLAG_NOREPLY 0x00000010
1045 struct ctdb_req_tunnel
{
1052 /* This is equivalent to server_id */
1053 struct ctdb_server_id
{
1060 enum ctdb_g_lock_type
{
1061 CTDB_G_LOCK_READ
= 0,
1062 CTDB_G_LOCK_WRITE
= 1,
1065 struct ctdb_g_lock
{
1066 enum ctdb_g_lock_type type
;
1067 struct ctdb_server_id sid
;
1070 struct ctdb_g_lock_list
{
1072 struct ctdb_g_lock
*lock
;
1076 * Generic packet header
1079 struct sock_packet_header
{
1084 #endif /* __CTDB_PROTOCOL_H__ */