2006-11-18 02:41:20 +03:00
/*
ctdb database library
Copyright ( C ) Andrew Tridgell 2006
2007-05-31 07:50:53 +04:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 09:29:31 +04:00
the Free Software Foundation ; either version 3 of the License , or
2007-05-31 07:50:53 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
2006-11-18 02:41:20 +03:00
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2007-05-31 07:50:53 +04:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 09:29:31 +04:00
along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2006-11-18 02:41:20 +03:00
*/
2007-01-23 03:38:45 +03:00
# ifndef _CTDB_PRIVATE_H
# define _CTDB_PRIVATE_H
# include "ctdb.h"
2007-05-25 07:05:25 +04:00
# include <sys/socket.h>
2006-11-18 02:41:20 +03:00
2007-04-11 05:01:42 +04:00
/* location of daemon socket */
# define CTDB_PATH " / tmp / ctdb.socket"
2007-05-29 09:15:00 +04:00
/* default ctdb port number */
2007-07-06 09:29:03 +04:00
# define CTDB_PORT 4379
2007-05-29 09:15:00 +04:00
2007-04-11 05:01:42 +04:00
/* we must align packets to ensure ctdb works on all architectures (eg. sparc) */
# define CTDB_DS_ALIGNMENT 8
2007-05-02 09:11:11 +04:00
# define CTDB_NULL_FUNC 0xFF000001
# define CTDB_FETCH_FUNC 0xFF000002
2007-04-04 15:15:56 +04:00
2008-03-27 01:23:27 +03:00
2008-04-01 08:34:54 +04:00
/*
recovery daemon memdump reply address
*/
struct rd_memdump_reply {
uint32_t pnn ;
uint64_t srvid ;
} ;
2009-10-14 04:59:16 +04:00
/*
description for a TAKEOVER_RUN message reply address
*/
struct takeover_run_reply {
uint32_t pnn ;
uint64_t srvid ;
} ;
2009-10-27 05:18:52 +03:00
/*
* pid of the ctdbd daemon
*/
extern pid_t ctdbd_pid ;
2007-07-20 09:05:55 +04:00
/*
a tcp connection description
*/
struct ctdb_tcp_connection {
2008-08-19 08:58:29 +04:00
ctdb_sock_addr src_addr ;
ctdb_sock_addr dst_addr ;
2007-07-20 09:05:55 +04:00
} ;
/* the wire representation for a tcp tickle array */
struct ctdb_tcp_wire_array {
uint32_t num ;
struct ctdb_tcp_connection connections [ 1 ] ;
} ;
/* the list of tcp tickles used by get/set tcp tickle list */
struct ctdb_control_tcp_tickle_list {
2008-08-19 08:58:29 +04:00
ctdb_sock_addr addr ;
2007-07-20 09:05:55 +04:00
struct ctdb_tcp_wire_array tickles ;
} ;
/*
array of tcp connections
*/
struct ctdb_tcp_array {
uint32_t num ;
struct ctdb_tcp_connection * connections ;
} ;
2007-06-04 11:23:55 +04:00
/* all tunable variables go in here */
struct ctdb_tunable {
uint32_t max_redirect_count ;
2009-04-01 10:21:38 +04:00
uint32_t seqnum_interval ; /* unit is ms */
2007-06-04 11:23:55 +04:00
uint32_t control_timeout ;
uint32_t traverse_timeout ;
2007-06-06 04:25:46 +04:00
uint32_t keepalive_interval ;
uint32_t keepalive_limit ;
2007-06-04 11:23:55 +04:00
uint32_t max_lacount ;
2007-06-04 14:22:44 +04:00
uint32_t recover_timeout ;
2007-06-06 04:25:46 +04:00
uint32_t recover_interval ;
2007-06-04 14:22:44 +04:00
uint32_t election_timeout ;
2007-06-05 11:43:19 +04:00
uint32_t takeover_timeout ;
2007-06-06 04:25:46 +04:00
uint32_t monitor_interval ;
2007-07-20 09:05:55 +04:00
uint32_t tickle_update_interval ;
2007-06-06 07:45:12 +04:00
uint32_t script_timeout ;
2009-12-14 07:53:23 +03:00
uint32_t script_timeout_count ; /* allow dodgy scripts to hang this many times in a row before we mark the node unhealthy */
2009-12-16 01:51:17 +03:00
uint32_t script_unhealthy_on_timeout ; /* obsolete */
2007-06-07 09:18:55 +04:00
uint32_t recovery_grace_period ;
uint32_t recovery_ban_period ;
2007-06-17 17:31:44 +04:00
uint32_t database_hash_size ;
2008-01-05 01:36:53 +03:00
uint32_t database_max_dead ;
2007-07-04 02:36:59 +04:00
uint32_t rerecovery_timeout ;
2007-10-15 07:22:58 +04:00
uint32_t enable_bans ;
2007-10-16 06:15:02 +04:00
uint32_t deterministic_public_ips ;
2008-03-03 01:19:30 +03:00
uint32_t reclock_ping_period ;
2008-03-03 04:52:16 +03:00
uint32_t no_ip_failback ;
2008-04-01 08:34:54 +04:00
uint32_t verbose_memory_names ;
2008-09-09 07:44:46 +04:00
uint32_t recd_ping_timeout ;
2008-09-17 08:17:41 +04:00
uint32_t recd_ping_failcount ;
2008-10-30 04:49:53 +03:00
uint32_t log_latency_ms ;
2009-05-14 04:33:25 +04:00
uint32_t reclock_latency_ms ;
2009-04-24 12:23:48 +04:00
uint32_t recovery_drop_all_ips ;
2009-04-30 19:18:27 +04:00
uint32_t verify_recovery_lock ;
2009-07-29 07:25:43 +04:00
uint32_t vacuum_default_interval ;
uint32_t vacuum_max_run_time ;
2009-07-29 00:09:28 +04:00
uint32_t repack_limit ;
2009-09-29 07:20:18 +04:00
uint32_t vacuum_limit ;
uint32_t vacuum_min_interval ;
uint32_t vacuum_max_interval ;
2009-10-21 08:20:55 +04:00
uint32_t max_queue_depth_drop_msg ;
2009-11-13 04:37:55 +03:00
uint32_t use_status_events_for_monitoring ;
2009-12-07 15:28:11 +03:00
uint32_t allow_unhealthy_db_read ;
2007-06-04 11:23:55 +04:00
} ;
2007-04-27 18:42:43 +04:00
2006-11-18 02:41:20 +03:00
/*
an installed ctdb remote call
*/
struct ctdb_registered_call {
struct ctdb_registered_call * next , * prev ;
uint32_t id ;
ctdb_fn_t fn ;
} ;
2006-11-27 13:38:13 +03:00
/*
this address structure might need to be generalised later for some
transports
*/
2006-11-18 03:21:40 +03:00
struct ctdb_address {
const char * address ;
int port ;
} ;
2007-04-18 12:39:02 +04:00
/*
2007-09-04 04:09:58 +04:00
check that a pnn is valid
2007-04-18 12:39:02 +04:00
*/
2007-09-04 04:09:58 +04:00
# define ctdb_validate_pnn(ctdb, pnn) (((uint32_t)(pnn)) < (ctdb)->num_nodes)
2007-04-18 12:39:02 +04:00
2007-04-10 13:33:21 +04:00
/* called from the queue code when a packet comes in. Called with data==NULL
on error */
2007-04-11 22:12:15 +04:00
typedef void ( * ctdb_queue_cb_fn_t ) ( uint8_t * data , size_t length ,
void * private_data ) ;
2007-04-10 13:33:21 +04:00
2007-04-26 16:27:49 +04:00
/* used for callbacks in ctdb_control requests */
typedef void ( * ctdb_control_callback_fn_t ) ( struct ctdb_context * ,
2007-05-18 17:48:29 +04:00
int32_t status , TDB_DATA data ,
2007-05-12 15:25:26 +04:00
const char * errormsg ,
2007-04-26 16:27:49 +04:00
void * private_data ) ;
2007-05-27 09:26:29 +04:00
/*
structure describing a connected client in the daemon
*/
struct ctdb_client {
struct ctdb_context * ctdb ;
int fd ;
struct ctdb_queue * queue ;
uint32_t client_id ;
2007-06-18 21:54:06 +04:00
pid_t pid ;
2007-05-27 09:26:29 +04:00
struct ctdb_tcp_list * tcp_list ;
2009-07-21 13:30:38 +04:00
uint32_t db_id ;
2008-07-17 07:50:55 +04:00
uint32_t num_persistent_updates ;
2009-10-23 08:24:51 +04:00
struct ctdb_client_notify_list * notify ;
2007-05-27 09:26:29 +04:00
} ;
2009-12-16 12:39:40 +03:00
struct ctdb_iface ;
2007-05-27 09:26:29 +04:00
2007-09-04 03:50:07 +04:00
/* state associated with a public ip address */
struct ctdb_vnn {
2007-09-04 12:20:29 +04:00
struct ctdb_vnn * prev , * next ;
2007-09-04 03:50:07 +04:00
2009-12-16 12:39:40 +03:00
struct ctdb_iface * iface ;
2009-12-14 20:52:06 +03:00
const char * * ifaces ;
2008-08-19 08:58:29 +04:00
ctdb_sock_addr public_address ;
2007-09-04 03:50:07 +04:00
uint8_t public_netmask_bits ;
/* the node number that is serving this public address, if any.
If no node serves this ip it is set to - 1 */
int32_t pnn ;
/* List of clients to tickle for this public address */
struct ctdb_tcp_array * tcp_array ;
/* whether we need to update the other nodes with changes to our list
of connected clients */
bool tcp_update_needed ;
2007-09-04 08:36:52 +04:00
/* a context to hang sending gratious arp events off */
TALLOC_CTX * takeover_ctx ;
2007-09-04 03:50:07 +04:00
struct ctdb_kill_tcp * killtcp ;
} ;
2006-11-18 02:41:20 +03:00
/*
state associated with one node
*/
struct ctdb_node {
struct ctdb_context * ctdb ;
2006-11-18 03:21:40 +03:00
struct ctdb_address address ;
2006-11-28 06:15:46 +03:00
const char * name ; /* for debug messages */
2007-04-11 22:12:15 +04:00
void * private_data ; /* private to transport */
2007-09-04 03:50:07 +04:00
uint32_t pnn ;
2007-06-07 09:18:55 +04:00
# define NODE_FLAGS_DISCONNECTED 0x00000001 /* node isn't connected */
# define NODE_FLAGS_UNHEALTHY 0x00000002 /* monitoring says node is unhealthy */
# define NODE_FLAGS_PERMANENTLY_DISABLED 0x00000004 /* administrator has disabled node */
# define NODE_FLAGS_BANNED 0x00000008 /* recovery daemon has banned the node */
2009-06-01 08:18:34 +04:00
# define NODE_FLAGS_DELETED 0x00000010 /* this node has been deleted */
2009-07-09 05:38:18 +04:00
# define NODE_FLAGS_STOPPED 0x00000020 /* this node has been stopped */
2009-07-09 06:22:46 +04:00
# define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
# define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
2007-04-28 14:40:26 +04:00
uint32_t flags ;
2007-05-18 13:19:35 +04:00
/* used by the dead node monitoring */
uint32_t dead_count ;
uint32_t rx_cnt ;
2007-05-19 04:20:19 +04:00
uint32_t tx_cnt ;
2007-05-18 17:48:29 +04:00
2008-05-06 09:42:59 +04:00
/* used to track node capabilities, is only valid/tracked inside the
recovery daemon .
*/
uint32_t capabilities ;
2007-05-18 17:48:29 +04:00
/* a list of controls pending to this node, so we can time them out quickly
if the node becomes disconnected */
struct daemon_control_state * pending_controls ;
2007-09-04 17:15:23 +04:00
/* used by the recovery daemon when distributing ip addresses
across the nodes . it needs to know which public ip ' s can be handled
by each node .
*/
2009-12-16 18:09:40 +03:00
struct ctdb_all_public_ips * known_public_ips ;
struct ctdb_all_public_ips * available_public_ips ;
2009-09-03 20:20:39 +04:00
/* used by the recovery dameon to track when a node should be banned */
struct ctdb_banning_state * ban_state ;
2006-11-18 02:41:20 +03:00
} ;
2006-11-18 05:45:04 +03:00
/*
2006-11-27 13:38:13 +03:00
transport specific methods
2006-11-18 05:45:04 +03:00
*/
2006-11-27 13:38:13 +03:00
struct ctdb_methods {
2007-05-30 07:26:50 +04:00
int ( * initialise ) ( struct ctdb_context * ) ; /* initialise transport structures */
2008-12-02 05:26:30 +03:00
int ( * start ) ( struct ctdb_context * ) ; /* start the transport */
2006-11-27 13:38:13 +03:00
int ( * add_node ) ( struct ctdb_node * ) ; /* setup a new node */
2008-12-02 05:26:30 +03:00
int ( * connect_node ) ( struct ctdb_node * ) ; /* connect to node */
2006-11-28 03:51:33 +03:00
int ( * queue_pkt ) ( struct ctdb_node * , uint8_t * data , uint32_t length ) ;
2007-04-19 04:37:44 +04:00
void * ( * allocate_pkt ) ( TALLOC_CTX * mem_ctx , size_t ) ;
2007-06-02 02:41:19 +04:00
void ( * shutdown ) ( struct ctdb_context * ) ; /* shutdown transport */
2007-10-19 02:58:30 +04:00
void ( * restart ) ( struct ctdb_node * ) ; /* stop and restart the connection */
2006-11-28 03:51:33 +03:00
} ;
/*
transport calls up to the ctdb layer
*/
struct ctdb_upcalls {
2006-11-28 09:56:10 +03:00
/* recv_pkt is called when a packet comes in */
2006-11-28 06:15:46 +03:00
void ( * recv_pkt ) ( struct ctdb_context * , uint8_t * data , uint32_t length ) ;
2006-11-28 09:56:10 +03:00
/* node_dead is called when an attempt to send to a node fails */
2006-11-28 06:15:46 +03:00
void ( * node_dead ) ( struct ctdb_node * ) ;
2006-11-28 09:56:10 +03:00
/* node_connected is called when a connection to a node is established */
void ( * node_connected ) ( struct ctdb_node * ) ;
2006-11-18 05:45:04 +03:00
} ;
2007-04-11 05:58:28 +04:00
/* list of message handlers - needs to be changed to a more efficient data
structure so we can find a message handler given a srvid quickly */
struct ctdb_message_list {
struct ctdb_context * ctdb ;
struct ctdb_message_list * next , * prev ;
2007-04-27 18:31:45 +04:00
uint64_t srvid ;
2007-04-11 05:58:28 +04:00
ctdb_message_fn_t message_handler ;
void * message_private ;
} ;
2007-04-10 00:03:39 +04:00
/* additional data required for the daemon mode */
struct ctdb_daemon_data {
int sd ;
char * name ;
2007-04-10 13:33:21 +04:00
struct ctdb_queue * queue ;
2007-04-10 00:03:39 +04:00
} ;
2007-04-03 13:41:00 +04:00
2007-04-20 14:07:47 +04:00
/*
ctdb status information
*/
2007-05-29 06:16:59 +04:00
struct ctdb_statistics {
2007-05-05 08:09:46 +04:00
uint32_t num_clients ;
2007-05-12 09:51:08 +04:00
uint32_t frozen ;
uint32_t recovering ;
2007-04-20 14:07:47 +04:00
uint32_t client_packets_sent ;
uint32_t client_packets_recv ;
uint32_t node_packets_sent ;
uint32_t node_packets_recv ;
2007-05-18 13:19:35 +04:00
uint32_t keepalive_packets_sent ;
uint32_t keepalive_packets_recv ;
2007-04-20 15:02:53 +04:00
struct {
uint32_t req_call ;
uint32_t reply_call ;
uint32_t req_dmaster ;
uint32_t reply_dmaster ;
uint32_t reply_error ;
uint32_t req_message ;
2007-04-26 16:27:49 +04:00
uint32_t req_control ;
uint32_t reply_control ;
2007-05-05 02:11:54 +04:00
} node ;
2007-04-20 15:02:53 +04:00
struct {
uint32_t req_call ;
uint32_t req_message ;
2007-04-26 16:27:49 +04:00
uint32_t req_control ;
2007-04-20 15:02:53 +04:00
} client ;
2007-05-10 08:06:48 +04:00
struct {
uint32_t call ;
uint32_t control ;
uint32_t traverse ;
} timeouts ;
2009-05-14 04:33:25 +04:00
struct {
double ctdbd ;
double recd ;
} reclock ;
2007-04-20 14:07:47 +04:00
uint32_t total_calls ;
uint32_t pending_calls ;
uint32_t lockwait_calls ;
uint32_t pending_lockwait_calls ;
2008-05-28 07:04:25 +04:00
uint32_t childwrite_calls ;
uint32_t pending_childwrite_calls ;
2007-05-05 02:33:35 +04:00
uint32_t memory_used ;
2007-05-29 06:16:59 +04:00
uint32_t __last_counter ; /* hack for control_statistics_all */
2007-05-01 07:25:02 +04:00
uint32_t max_hop_count ;
2007-04-20 14:07:47 +04:00
double max_call_latency ;
double max_lockwait_latency ;
2008-05-28 07:04:25 +04:00
double max_childwrite_latency ;
2007-04-20 14:07:47 +04:00
} ;
2007-08-22 06:38:31 +04:00
# define INVALID_GENERATION 1
2007-04-27 12:43:52 +04:00
/* table that contains the mapping between a hash value and lmaster
*/
struct ctdb_vnn_map {
2007-05-10 02:13:19 +04:00
uint32_t generation ;
uint32_t size ;
uint32_t * map ;
} ;
/*
a wire representation of the vnn map
*/
struct ctdb_vnn_map_wire {
2007-04-27 12:43:52 +04:00
uint32_t generation ;
uint32_t size ;
2007-05-03 05:06:24 +04:00
uint32_t map [ 1 ] ;
2007-04-27 12:43:52 +04:00
} ;
2007-05-03 10:18:03 +04:00
/* a structure that contains the elements required for the write record
control
*/
struct ctdb_write_record {
uint32_t dbid ;
uint32_t keylen ;
uint32_t datalen ;
unsigned char blob [ 1 ] ;
} ;
2007-05-12 08:34:21 +04:00
2007-05-12 09:15:27 +04:00
enum ctdb_freeze_mode { CTDB_FREEZE_NONE , CTDB_FREEZE_PENDING , CTDB_FREEZE_FROZEN } ;
2007-05-12 08:34:21 +04:00
2007-05-21 03:24:34 +04:00
# define CTDB_MONITORING_ACTIVE 0
# define CTDB_MONITORING_DISABLED 1
2008-05-06 04:02:27 +04:00
/* The different capabilities of the ctdb daemon. */
# define CTDB_CAP_RECMASTER 0x00000001
# define CTDB_CAP_LMASTER 0x00000002
2008-07-10 04:37:22 +04:00
/* This capability is set if CTDB_LVS_PUBLIC_IP is set */
# define CTDB_CAP_LVS 0x00000004
2009-07-28 03:58:11 +04:00
/* This capability is set if NATGW is enabled */
# define CTDB_CAP_NATGW 0x00000008
2008-05-06 04:02:27 +04:00
2009-10-12 05:08:39 +04:00
# define NUM_DB_PRIORITIES 3
2006-11-18 02:41:20 +03:00
/* main state of the ctdb daemon */
struct ctdb_context {
struct event_context * ev ;
2008-01-17 03:33:23 +03:00
struct timeval ctdbd_start_time ;
2008-07-02 07:55:59 +04:00
struct timeval last_recovery_started ;
struct timeval last_recovery_finished ;
2007-04-29 16:51:56 +04:00
uint32_t recovery_mode ;
2007-07-20 09:05:55 +04:00
TALLOC_CTX * tickle_update_context ;
2008-01-15 00:42:12 +03:00
TALLOC_CTX * keepalive_ctx ;
2007-06-04 11:46:37 +04:00
struct ctdb_tunable tunable ;
2009-10-12 05:08:39 +04:00
enum ctdb_freeze_mode freeze_mode [ NUM_DB_PRIORITIES + 1 ] ;
struct ctdb_freeze_handle * freeze_handles [ NUM_DB_PRIORITIES + 1 ] ;
bool freeze_transaction_started ;
uint32_t freeze_transaction_id ;
2006-11-18 03:21:40 +03:00
struct ctdb_address address ;
2006-11-28 09:56:10 +03:00
const char * name ;
2007-04-18 18:36:22 +04:00
const char * db_directory ;
2007-09-21 06:24:02 +04:00
const char * db_directory_persistent ;
2009-11-23 16:38:03 +03:00
const char * db_directory_state ;
2009-11-29 14:39:37 +03:00
struct tdb_wrap * db_persistent_health ;
2009-12-07 15:28:11 +03:00
uint32_t db_persistent_startup_generation ;
uint64_t db_persistent_check_errors ;
uint64_t max_persistent_check_errors ;
2007-04-26 17:28:13 +04:00
const char * transport ;
2007-06-02 05:36:42 +04:00
char * recovery_lock_file ;
int recovery_lock_fd ;
2007-09-04 04:06:36 +04:00
uint32_t pnn ; /* our own pnn */
2006-11-28 09:56:10 +03:00
uint32_t num_nodes ;
2006-12-01 01:01:11 +03:00
uint32_t num_connected ;
2006-12-01 07:45:24 +03:00
unsigned flags ;
2008-05-06 04:02:27 +04:00
uint32_t capabilities ;
2006-11-28 12:48:34 +03:00
struct idr_context * idr ;
2007-04-23 12:19:50 +04:00
uint16_t idr_cnt ;
2006-11-28 09:56:10 +03:00
struct ctdb_node * * nodes ; /* array of nodes in the cluster - indexed by vnn */
2007-09-04 12:20:29 +04:00
struct ctdb_vnn * vnn ; /* list of public ip addresses and interfaces */
2007-10-10 03:42:32 +04:00
struct ctdb_vnn * single_ip_vnn ; /* a structure for the single ip */
2009-12-16 12:39:40 +03:00
struct ctdb_iface * ifaces ; /* list of local interfaces */
2006-11-18 02:41:20 +03:00
char * err_msg ;
2006-11-27 13:38:13 +03:00
const struct ctdb_methods * methods ; /* transport methods */
2006-11-28 03:51:33 +03:00
const struct ctdb_upcalls * upcalls ; /* transport upcalls */
2007-04-11 22:12:15 +04:00
void * private_data ; /* private to transport */
2007-04-03 13:41:00 +04:00
struct ctdb_db_context * db_list ;
2007-04-11 05:58:28 +04:00
struct ctdb_message_list * message_list ;
2007-04-10 00:03:39 +04:00
struct ctdb_daemon_data daemon ;
2007-05-29 06:16:59 +04:00
struct ctdb_statistics statistics ;
2007-04-27 12:43:52 +04:00
struct ctdb_vnn_map * vnn_map ;
2007-04-28 17:15:21 +04:00
uint32_t num_clients ;
2007-05-06 23:02:48 +04:00
uint32_t recovery_master ;
2007-05-18 18:56:49 +04:00
struct ctdb_call_state * pending_calls ;
2007-06-18 21:54:06 +04:00
struct ctdb_client_ip * client_ip_list ;
2008-11-24 11:06:02 +03:00
bool do_checkpublicip ;
2007-08-24 09:53:41 +04:00
struct _trbt_tree_t * server_ids ;
2007-09-04 03:50:07 +04:00
const char * event_script_dir ;
2009-03-31 07:23:31 +04:00
const char * notification_script ;
2007-09-10 08:27:29 +04:00
const char * default_public_interface ;
2008-01-07 08:17:22 +03:00
pid_t ctdbd_pid ;
2007-10-22 06:34:08 +04:00
pid_t recoverd_pid ;
2009-11-16 07:17:32 +03:00
pid_t syslogd_pid ;
2007-11-12 02:53:11 +03:00
bool done_startup ;
2007-11-26 02:52:55 +03:00
const char * node_ip ;
2008-01-10 06:40:56 +03:00
struct ctdb_monitor_state * monitor ;
2008-01-16 14:03:01 +03:00
struct ctdb_log_state * log ;
2008-02-22 01:42:52 +03:00
int start_as_disabled ;
2009-07-09 05:57:20 +04:00
int start_as_stopped ;
2009-12-16 13:29:15 +03:00
bool valgrinding ;
2008-06-13 07:18:06 +04:00
uint32_t event_script_timeouts ; /* counting how many consecutive times an eventscript has timedout */
2008-09-17 08:17:41 +04:00
uint32_t * recd_ping_count ;
2008-10-22 04:04:41 +04:00
TALLOC_CTX * release_ips_ctx ; /* a context used to automatically drop all IPs if we fail to recover the node */
2009-11-25 03:30:11 +03:00
2009-12-07 16:39:20 +03:00
TALLOC_CTX * event_script_ctx ;
2009-11-25 03:30:11 +03:00
2009-12-07 16:44:01 +03:00
struct ctdb_event_script_state * current_monitor ;
2009-12-08 04:57:48 +03:00
struct ctdb_scripts_wire * last_status [ CTDB_EVENT_MAX ] ;
2009-11-25 03:30:11 +03:00
2009-09-03 20:20:39 +04:00
TALLOC_CTX * banning_ctx ;
2009-12-02 05:41:04 +03:00
/* mapping from pid to ctdb_client * */
struct ctdb_client_pid_list * client_pids ;
2007-04-03 13:41:00 +04:00
} ;
struct ctdb_db_context {
struct ctdb_db_context * next , * prev ;
struct ctdb_context * ctdb ;
uint32_t db_id ;
2009-10-10 07:26:09 +04:00
uint32_t priority ;
2007-09-21 06:24:02 +04:00
bool persistent ;
2007-04-03 13:41:00 +04:00
const char * db_name ;
2007-04-27 01:10:35 +04:00
const char * db_path ;
2007-04-03 13:41:00 +04:00
struct tdb_wrap * ltdb ;
struct ctdb_registered_call * calls ; /* list of registered calls */
2007-05-04 16:18:00 +04:00
uint32_t seqnum ;
2009-12-08 19:00:55 +03:00
struct timed_event * seqnum_update ;
2009-05-06 01:32:25 +04:00
struct ctdb_traverse_local_handle * traverse ;
2009-07-21 13:30:38 +04:00
bool transaction_active ;
2009-07-29 07:25:43 +04:00
struct ctdb_vacuum_handle * vacuum_handle ;
2009-12-07 15:28:11 +03:00
char * unhealthy_reason ;
2006-11-18 02:41:20 +03:00
} ;
2007-04-09 05:51:27 +04:00
2006-11-27 13:38:13 +03:00
# define CTDB_NO_MEMORY(ctdb, p) do { if (!(p)) { \
2007-05-10 07:15:58 +04:00
DEBUG ( 0 , ( " Out of memory for %s at %s \n " , # p , __location__ ) ) ; \
2006-11-27 13:38:13 +03:00
ctdb_set_error ( ctdb , " Out of memory at %s:%d " , __FILE__ , __LINE__ ) ; \
return - 1 ; } } while ( 0 )
2007-04-26 16:27:49 +04:00
# define CTDB_NO_MEMORY_VOID(ctdb, p) do { if (!(p)) { \
2007-05-10 07:15:58 +04:00
DEBUG ( 0 , ( " Out of memory for %s at %s \n " , # p , __location__ ) ) ; \
2007-04-26 16:27:49 +04:00
ctdb_set_error ( ctdb , " Out of memory at %s:%d " , __FILE__ , __LINE__ ) ; \
2008-07-04 10:58:29 +04:00
return ; } } while ( 0 )
2007-04-26 16:27:49 +04:00
2006-12-01 12:26:21 +03:00
# define CTDB_NO_MEMORY_NULL(ctdb, p) do { if (!(p)) { \
2007-05-10 07:15:58 +04:00
DEBUG ( 0 , ( " Out of memory for %s at %s \n " , # p , __location__ ) ) ; \
2006-12-01 12:26:21 +03:00
ctdb_set_error ( ctdb , " Out of memory at %s:%d " , __FILE__ , __LINE__ ) ; \
return NULL ; } } while ( 0 )
2006-12-18 08:26:57 +03:00
# define CTDB_NO_MEMORY_FATAL(ctdb, p) do { if (!(p)) { \
2007-05-10 07:15:58 +04:00
DEBUG ( 0 , ( " Out of memory for %s at %s \n " , # p , __location__ ) ) ; \
2006-12-18 08:26:57 +03:00
ctdb_fatal ( ctdb , " Out of memory in " __location__ ) ; \
} } while ( 0 )
2006-12-18 05:24:02 +03:00
/*
the extended header for records in the ltdb
*/
struct ctdb_ltdb_header {
uint64_t rsn ;
uint32_t dmaster ;
uint32_t laccessor ;
uint32_t lacount ;
} ;
2007-06-04 11:46:37 +04:00
enum ctdb_controls { CTDB_CONTROL_PROCESS_EXISTS = 0 ,
CTDB_CONTROL_STATISTICS = 1 ,
/* #2 removed */
CTDB_CONTROL_PING = 3 ,
CTDB_CONTROL_GETDBPATH = 4 ,
CTDB_CONTROL_GETVNNMAP = 5 ,
CTDB_CONTROL_SETVNNMAP = 6 ,
CTDB_CONTROL_GET_DEBUG = 7 ,
CTDB_CONTROL_SET_DEBUG = 8 ,
CTDB_CONTROL_GET_DBMAP = 9 ,
2008-10-14 03:40:29 +04:00
CTDB_CONTROL_GET_NODEMAPv4 = 10 , /* obsolete */
2007-06-04 11:46:37 +04:00
CTDB_CONTROL_SET_DMASTER = 11 ,
2007-06-05 11:57:07 +04:00
/* #12 removed */
2007-06-04 11:46:37 +04:00
CTDB_CONTROL_PULL_DB = 13 ,
CTDB_CONTROL_PUSH_DB = 14 ,
CTDB_CONTROL_GET_RECMODE = 15 ,
CTDB_CONTROL_SET_RECMODE = 16 ,
CTDB_CONTROL_STATISTICS_RESET = 17 ,
CTDB_CONTROL_DB_ATTACH = 18 ,
CTDB_CONTROL_SET_CALL = 19 ,
CTDB_CONTROL_TRAVERSE_START = 20 ,
CTDB_CONTROL_TRAVERSE_ALL = 21 ,
CTDB_CONTROL_TRAVERSE_DATA = 22 ,
CTDB_CONTROL_REGISTER_SRVID = 23 ,
CTDB_CONTROL_DEREGISTER_SRVID = 24 ,
CTDB_CONTROL_GET_DBNAME = 25 ,
CTDB_CONTROL_ENABLE_SEQNUM = 26 ,
CTDB_CONTROL_UPDATE_SEQNUM = 27 ,
/* #28 removed */
CTDB_CONTROL_DUMP_MEMORY = 29 ,
CTDB_CONTROL_GET_PID = 30 ,
CTDB_CONTROL_GET_RECMASTER = 31 ,
CTDB_CONTROL_SET_RECMASTER = 32 ,
CTDB_CONTROL_FREEZE = 33 ,
CTDB_CONTROL_THAW = 34 ,
2007-09-04 04:38:48 +04:00
CTDB_CONTROL_GET_PNN = 35 ,
2007-06-04 11:46:37 +04:00
CTDB_CONTROL_SHUTDOWN = 36 ,
CTDB_CONTROL_GET_MONMODE = 37 ,
2007-11-30 02:00:04 +03:00
/* #38 removed */
2008-01-06 04:38:01 +03:00
/* #39 removed */
/* #40 removed */
/* #41 removed */
2008-10-14 03:40:29 +04:00
CTDB_CONTROL_TAKEOVER_IPv4 = 42 , /* obsolete */
CTDB_CONTROL_RELEASE_IPv4 = 43 , /* obsolete */
2007-06-04 11:46:37 +04:00
CTDB_CONTROL_TCP_CLIENT = 44 ,
CTDB_CONTROL_TCP_ADD = 45 ,
CTDB_CONTROL_TCP_REMOVE = 46 ,
CTDB_CONTROL_STARTUP = 47 ,
2007-06-04 13:53:19 +04:00
CTDB_CONTROL_SET_TUNABLE = 48 ,
CTDB_CONTROL_GET_TUNABLE = 49 ,
CTDB_CONTROL_LIST_TUNABLES = 50 ,
2008-10-14 03:40:29 +04:00
CTDB_CONTROL_GET_PUBLIC_IPSv4 = 51 , /* obsolete */
2007-06-07 09:18:55 +04:00
CTDB_CONTROL_MODIFY_FLAGS = 52 ,
2007-06-07 12:05:25 +04:00
CTDB_CONTROL_GET_ALL_TUNABLES = 53 ,
2007-07-11 12:24:25 +04:00
CTDB_CONTROL_KILL_TCP = 54 ,
2007-07-20 09:05:55 +04:00
CTDB_CONTROL_GET_TCP_TICKLE_LIST = 55 ,
CTDB_CONTROL_SET_TCP_TICKLE_LIST = 56 ,
2007-08-24 09:53:41 +04:00
CTDB_CONTROL_REGISTER_SERVER_ID = 57 ,
CTDB_CONTROL_UNREGISTER_SERVER_ID = 58 ,
CTDB_CONTROL_CHECK_SERVER_ID = 59 ,
CTDB_CONTROL_GET_SERVER_ID_LIST = 60 ,
2007-09-21 06:24:02 +04:00
CTDB_CONTROL_DB_ATTACH_PERSISTENT = 61 ,
CTDB_CONTROL_PERSISTENT_STORE = 62 ,
CTDB_CONTROL_UPDATE_RECORD = 63 ,
2007-10-09 05:56:09 +04:00
CTDB_CONTROL_SEND_GRATIOUS_ARP = 64 ,
2008-01-06 04:38:01 +03:00
CTDB_CONTROL_TRANSACTION_START = 65 ,
CTDB_CONTROL_TRANSACTION_COMMIT = 66 ,
CTDB_CONTROL_WIPE_DATABASE = 67 ,
2008-03-12 23:53:29 +03:00
/* #68 removed */
2008-01-17 03:33:23 +03:00
CTDB_CONTROL_UPTIME = 69 ,
2008-01-29 05:59:28 +03:00
CTDB_CONTROL_START_RECOVERY = 70 ,
CTDB_CONTROL_END_RECOVERY = 71 ,
2008-02-19 06:44:48 +03:00
CTDB_CONTROL_RELOAD_NODES_FILE = 72 ,
2008-08-06 05:52:26 +04:00
/* #73 removed */
2008-03-12 23:53:29 +03:00
CTDB_CONTROL_TRY_DELETE_RECORDS = 74 ,
2008-03-25 00:27:38 +03:00
CTDB_CONTROL_ENABLE_MONITOR = 75 ,
CTDB_CONTROL_DISABLE_MONITOR = 76 ,
2008-03-27 01:23:27 +03:00
CTDB_CONTROL_ADD_PUBLIC_IP = 77 ,
CTDB_CONTROL_DEL_PUBLIC_IP = 78 ,
2008-04-02 04:13:30 +04:00
CTDB_CONTROL_RUN_EVENTSCRIPTS = 79 ,
2008-05-06 04:02:27 +04:00
CTDB_CONTROL_GET_CAPABILITIES = 80 ,
2008-07-17 07:50:55 +04:00
CTDB_CONTROL_START_PERSISTENT_UPDATE = 81 ,
CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE = 82 ,
2008-07-30 13:57:00 +04:00
CTDB_CONTROL_TRANS2_COMMIT = 83 ,
CTDB_CONTROL_TRANS2_FINISHED = 84 ,
CTDB_CONTROL_TRANS2_ERROR = 85 ,
2008-08-08 07:11:28 +04:00
CTDB_CONTROL_TRANS2_COMMIT_RETRY = 86 ,
2008-09-09 07:44:46 +04:00
CTDB_CONTROL_RECD_PING = 87 ,
2008-10-14 03:40:29 +04:00
CTDB_CONTROL_RELEASE_IP = 88 ,
CTDB_CONTROL_TAKEOVER_IP = 89 ,
CTDB_CONTROL_GET_PUBLIC_IPS = 90 ,
CTDB_CONTROL_GET_NODEMAP = 91 ,
2009-03-23 11:07:45 +03:00
CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS = 96 ,
2009-05-06 01:32:25 +04:00
CTDB_CONTROL_TRAVERSE_KILL = 97 ,
2009-05-14 04:33:25 +04:00
CTDB_CONTROL_RECD_RECLOCK_LATENCY = 98 ,
2009-06-25 06:17:19 +04:00
CTDB_CONTROL_GET_RECLOCK_FILE = 99 ,
2009-06-25 08:25:18 +04:00
CTDB_CONTROL_SET_RECLOCK_FILE = 100 ,
2009-07-09 06:22:46 +04:00
CTDB_CONTROL_STOP_NODE = 101 ,
CTDB_CONTROL_CONTINUE_NODE = 102 ,
2009-07-28 03:58:11 +04:00
CTDB_CONTROL_SET_NATGWSTATE = 103 ,
2009-07-28 07:45:13 +04:00
CTDB_CONTROL_SET_LMASTERROLE = 104 ,
CTDB_CONTROL_SET_RECMASTERROLE = 105 ,
2009-08-13 07:04:08 +04:00
CTDB_CONTROL_ENABLE_SCRIPT = 107 ,
CTDB_CONTROL_DISABLE_SCRIPT = 108 ,
2009-09-03 20:20:39 +04:00
CTDB_CONTROL_SET_BAN_STATE = 109 ,
CTDB_CONTROL_GET_BAN_STATE = 110 ,
2009-10-10 07:26:09 +04:00
CTDB_CONTROL_SET_DB_PRIORITY = 111 ,
2009-10-10 08:04:18 +04:00
CTDB_CONTROL_GET_DB_PRIORITY = 112 ,
2009-10-12 09:48:05 +04:00
CTDB_CONTROL_TRANSACTION_CANCEL = 113 ,
2009-10-23 08:24:51 +04:00
CTDB_CONTROL_REGISTER_NOTIFY = 114 ,
CTDB_CONTROL_DEREGISTER_NOTIFY = 115 ,
2009-10-29 02:49:00 +03:00
CTDB_CONTROL_TRANS2_ACTIVE = 116 ,
2009-11-18 04:44:18 +03:00
CTDB_CONTROL_GET_LOG = 117 ,
CTDB_CONTROL_CLEAR_LOG = 118 ,
2009-12-03 19:59:49 +03:00
CTDB_CONTROL_TRANS3_COMMIT = 119 ,
2009-12-11 17:31:02 +03:00
CTDB_CONTROL_GET_DB_SEQNUM = 120 ,
2009-12-02 14:48:22 +03:00
CTDB_CONTROL_DB_SET_HEALTHY = 121 ,
CTDB_CONTROL_DB_GET_HEALTH = 122 ,
2009-12-16 16:40:21 +03:00
CTDB_CONTROL_GET_PUBLIC_IP_INFO = 123 ,
CTDB_CONTROL_GET_IFACES = 124 ,
CTDB_CONTROL_SET_IFACE_LINK_STATE = 125 ,
2007-08-24 09:53:41 +04:00
} ;
2007-05-25 07:05:25 +04:00
2007-04-30 17:31:40 +04:00
/*
structure passed in set_call control
*/
struct ctdb_control_set_call {
uint32_t db_id ;
ctdb_fn_t fn ;
uint32_t id ;
} ;
2007-07-11 12:24:25 +04:00
/*
struct for kill_tcp control
*/
2007-07-12 02:30:04 +04:00
struct ctdb_control_killtcp {
2008-08-19 08:58:29 +04:00
ctdb_sock_addr src_addr ;
ctdb_sock_addr dst_addr ;
2007-07-11 12:24:25 +04:00
} ;
2007-10-09 05:56:09 +04:00
/*
2008-08-19 08:58:29 +04:00
struct holding a ctdb_sock_addr and an interface name ,
2008-06-04 09:13:00 +04:00
used to add / remove public addresses
2007-10-09 05:56:09 +04:00
*/
2008-03-27 01:23:27 +03:00
struct ctdb_control_ip_iface {
2008-08-19 08:58:29 +04:00
ctdb_sock_addr addr ;
2008-03-27 01:23:27 +03:00
uint32_t mask ;
2007-10-09 05:56:09 +04:00
uint32_t len ;
char iface [ 1 ] ;
} ;
2008-06-04 09:13:00 +04:00
/*
struct holding a ctdb_sock_addr and an interface name ,
used for send_gratious_arp
*/
struct ctdb_control_gratious_arp {
ctdb_sock_addr addr ;
uint32_t mask ;
uint32_t len ;
char iface [ 1 ] ;
} ;
2007-05-27 18:34:40 +04:00
/*
struct for tcp_add and tcp_remove controls
*/
struct ctdb_control_tcp_vnn {
2008-08-19 08:58:29 +04:00
ctdb_sock_addr src ;
ctdb_sock_addr dest ;
2007-05-27 18:34:40 +04:00
} ;
2007-09-21 06:24:02 +04:00
/*
persistent store control - update this record on all other nodes
*/
struct ctdb_control_persistent_store {
uint32_t db_id ;
uint32_t len ;
uint8_t data [ 1 ] ;
} ;
2007-06-06 04:25:46 +04:00
/*
structure used for CTDB_SRVID_NODE_FLAGS_CHANGED
*/
struct ctdb_node_flag_change {
2007-09-04 04:33:10 +04:00
uint32_t pnn ;
2007-08-21 11:25:15 +04:00
uint32_t new_flags ;
uint32_t old_flags ;
2007-06-06 04:25:46 +04:00
} ;
2007-06-07 10:34:33 +04:00
/*
struct for admin setting a ban
*/
struct ctdb_ban_info {
2007-09-04 04:33:10 +04:00
uint32_t pnn ;
2007-06-07 10:34:33 +04:00
uint32_t ban_time ;
} ;
2007-04-09 05:51:27 +04:00
enum call_state { CTDB_CALL_WAIT , CTDB_CALL_DONE , CTDB_CALL_ERROR } ;
2007-05-02 04:20:34 +04:00
# define CTDB_LMASTER_ANY 0xffffffff
2007-04-09 05:51:27 +04:00
/*
state of a in - progress ctdb call
*/
struct ctdb_call_state {
2007-05-18 18:56:49 +04:00
struct ctdb_call_state * next , * prev ;
2007-04-09 05:51:27 +04:00
enum call_state state ;
2007-04-23 12:19:50 +04:00
uint32_t reqid ;
2007-04-09 05:51:27 +04:00
struct ctdb_req_call * c ;
struct ctdb_db_context * ctdb_db ;
const char * errmsg ;
2008-03-19 05:54:17 +03:00
struct ctdb_call * call ;
2007-05-10 08:06:48 +04:00
uint32_t generation ;
2007-04-12 09:46:50 +04:00
struct {
void ( * fn ) ( struct ctdb_call_state * ) ;
2007-04-13 14:38:24 +04:00
void * private_data ;
2007-04-12 09:46:50 +04:00
} async ;
2007-04-09 05:51:27 +04:00
} ;
2006-11-28 12:48:34 +03:00
2007-04-17 06:36:31 +04:00
/* used for fetch_lock */
2007-04-18 05:20:24 +04:00
struct ctdb_fetch_handle {
2007-04-17 06:36:31 +04:00
struct ctdb_db_context * ctdb_db ;
TDB_DATA key ;
TDB_DATA * data ;
2007-04-17 08:52:51 +04:00
struct ctdb_ltdb_header header ;
2007-04-17 06:36:31 +04:00
} ;
2006-11-28 09:56:10 +03:00
/*
operation IDs
*/
enum ctdb_operation {
2007-04-11 08:54:47 +04:00
CTDB_REQ_CALL = 0 ,
2007-06-04 11:46:37 +04:00
CTDB_REPLY_CALL = 1 ,
CTDB_REQ_DMASTER = 2 ,
CTDB_REPLY_DMASTER = 3 ,
CTDB_REPLY_ERROR = 4 ,
CTDB_REQ_MESSAGE = 5 ,
/* #6 removed */
CTDB_REQ_CONTROL = 7 ,
CTDB_REPLY_CONTROL = 8 ,
CTDB_REQ_KEEPALIVE = 9 ,
2006-11-28 09:56:10 +03:00
} ;
2007-04-06 08:41:05 +04:00
# define CTDB_MAGIC 0x43544442 /* CTDB */
# define CTDB_VERSION 1
2006-11-28 09:56:10 +03:00
/*
packet structures
*/
struct ctdb_req_header {
2006-12-01 07:45:24 +03:00
uint32_t length ;
2007-04-06 08:41:05 +04:00
uint32_t ctdb_magic ;
uint32_t ctdb_version ;
2007-04-27 19:06:26 +04:00
uint32_t generation ;
2006-11-28 09:56:10 +03:00
uint32_t operation ;
uint32_t destnode ;
uint32_t srcnode ;
uint32_t reqid ;
} ;
struct ctdb_req_call {
struct ctdb_req_header hdr ;
2007-04-04 15:15:56 +04:00
uint32_t flags ;
2007-04-03 13:41:00 +04:00
uint32_t db_id ;
2006-11-28 09:56:10 +03:00
uint32_t callid ;
2007-05-01 07:25:02 +04:00
uint32_t hopcount ;
2006-11-28 09:56:10 +03:00
uint32_t keylen ;
uint32_t calldatalen ;
2007-01-23 03:38:45 +03:00
uint8_t data [ 1 ] ; /* key[] followed by calldata[] */
2006-11-28 09:56:10 +03:00
} ;
struct ctdb_reply_call {
2006-12-01 07:45:24 +03:00
struct ctdb_req_header hdr ;
2007-01-29 14:30:06 +03:00
uint32_t status ;
2006-11-28 09:56:10 +03:00
uint32_t datalen ;
2007-01-23 03:38:45 +03:00
uint8_t data [ 1 ] ;
2006-11-28 09:56:10 +03:00
} ;
2006-11-27 13:38:13 +03:00
2006-12-18 06:27:20 +03:00
struct ctdb_reply_error {
struct ctdb_req_header hdr ;
uint32_t status ;
uint32_t msglen ;
2007-01-23 03:38:45 +03:00
uint8_t msg [ 1 ] ;
2006-12-18 06:27:20 +03:00
} ;
2006-12-18 08:01:11 +03:00
struct ctdb_req_dmaster {
struct ctdb_req_header hdr ;
2007-04-03 13:41:00 +04:00
uint32_t db_id ;
2007-04-29 18:19:40 +04:00
uint64_t rsn ;
2006-12-18 08:01:11 +03:00
uint32_t dmaster ;
uint32_t keylen ;
uint32_t datalen ;
2007-01-23 03:38:45 +03:00
uint8_t data [ 1 ] ;
2006-12-18 08:01:11 +03:00
} ;
struct ctdb_reply_dmaster {
struct ctdb_req_header hdr ;
2007-04-29 18:19:40 +04:00
uint32_t db_id ;
uint64_t rsn ;
uint32_t keylen ;
2006-12-18 08:01:11 +03:00
uint32_t datalen ;
2007-01-23 03:38:45 +03:00
uint8_t data [ 1 ] ;
2006-12-18 08:01:11 +03:00
} ;
2007-02-09 01:42:04 +03:00
struct ctdb_req_message {
struct ctdb_req_header hdr ;
2007-04-27 18:31:45 +04:00
uint64_t srvid ;
2007-02-09 01:42:04 +03:00
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2007-04-23 18:06:48 +04:00
struct ctdb_req_getdbpath {
struct ctdb_req_header hdr ;
uint32_t db_id ;
} ;
struct ctdb_reply_getdbpath {
struct ctdb_req_header hdr ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2007-04-26 16:27:49 +04:00
struct ctdb_req_control {
struct ctdb_req_header hdr ;
uint32_t opcode ;
2007-04-27 18:31:45 +04:00
uint64_t srvid ;
2007-05-04 05:41:29 +04:00
uint32_t client_id ;
2007-05-16 06:34:30 +04:00
# define CTDB_CTRL_FLAG_NOREPLY 1
2009-12-21 14:10:18 +03:00
# define CTDB_CTRL_FLAG_OPCODE_SPECIFIC 0xFFFF0000
2007-04-30 17:31:40 +04:00
uint32_t flags ;
2007-04-26 16:27:49 +04:00
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
struct ctdb_reply_control {
struct ctdb_req_header hdr ;
int32_t status ;
uint32_t datalen ;
2007-05-12 15:25:26 +04:00
uint32_t errorlen ;
2007-04-26 16:27:49 +04:00
uint8_t data [ 1 ] ;
} ;
2007-05-18 13:19:35 +04:00
struct ctdb_req_keepalive {
struct ctdb_req_header hdr ;
} ;
2007-04-26 16:27:49 +04:00
2008-08-08 03:58:49 +04:00
/* types of failures possible from TRANS2_COMMIT */
enum ctdb_trans2_commit_error {
CTDB_TRANS2_COMMIT_SUCCESS = 0 , /* all nodes committed successfully */
CTDB_TRANS2_COMMIT_TIMEOUT = 1 , /* at least one node timed out */
CTDB_TRANS2_COMMIT_ALLFAIL = 2 , /* all nodes failed the commit */
CTDB_TRANS2_COMMIT_SOMEFAIL = 3 /* some nodes failed the commit, some allowed it */
} ;
2006-11-27 13:38:13 +03:00
/* internal prototypes */
2007-01-23 03:38:45 +03:00
void ctdb_set_error ( struct ctdb_context * ctdb , const char * fmt , . . . ) PRINTF_ATTRIBUTE ( 2 , 3 ) ;
2006-12-18 08:01:11 +03:00
void ctdb_fatal ( struct ctdb_context * ctdb , const char * msg ) ;
2006-11-27 13:38:13 +03:00
bool ctdb_same_address ( struct ctdb_address * a1 , struct ctdb_address * a2 ) ;
2006-11-28 09:56:10 +03:00
int ctdb_parse_address ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx , const char * str ,
struct ctdb_address * address ) ;
2008-08-19 08:58:29 +04:00
bool ctdb_same_ip ( const ctdb_sock_addr * ip1 , const ctdb_sock_addr * ip2 ) ;
bool ctdb_same_sockaddr ( const ctdb_sock_addr * ip1 , const ctdb_sock_addr * ip2 ) ;
2006-12-18 08:01:11 +03:00
uint32_t ctdb_hash ( const TDB_DATA * key ) ;
2007-04-30 17:31:40 +04:00
uint32_t ctdb_hash_string ( const char * str ) ;
2006-12-01 07:45:24 +03:00
void ctdb_request_call ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
2006-12-18 08:01:11 +03:00
void ctdb_request_dmaster ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
2007-02-09 01:42:04 +03:00
void ctdb_request_message ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
2006-12-18 08:01:11 +03:00
void ctdb_reply_dmaster ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
2006-12-01 07:45:24 +03:00
void ctdb_reply_call ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
2006-12-18 06:27:20 +03:00
void ctdb_reply_error ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
2006-11-18 02:41:20 +03:00
2006-12-18 08:01:11 +03:00
uint32_t ctdb_lmaster ( struct ctdb_context * ctdb , const TDB_DATA * key ) ;
2007-04-03 13:41:00 +04:00
int ctdb_ltdb_fetch ( struct ctdb_db_context * ctdb_db ,
2007-04-07 04:45:00 +04:00
TDB_DATA key , struct ctdb_ltdb_header * header ,
TALLOC_CTX * mem_ctx , TDB_DATA * data ) ;
2007-04-03 13:41:00 +04:00
int ctdb_ltdb_store ( struct ctdb_db_context * ctdb_db , TDB_DATA key ,
2006-12-18 05:24:02 +03:00
struct ctdb_ltdb_header * header , TDB_DATA data ) ;
2008-07-17 07:50:55 +04:00
int32_t ctdb_control_start_persistent_update ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA recdata ) ;
int32_t ctdb_control_cancel_persistent_update ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA recdata ) ;
2007-02-09 01:42:04 +03:00
void ctdb_queue_packet ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
2008-07-04 12:00:24 +04:00
void ctdb_queue_packet_opcode ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr , unsigned opcode ) ;
2007-04-19 11:43:27 +04:00
int ctdb_ltdb_lock_requeue ( struct ctdb_db_context * ctdb_db ,
TDB_DATA key , struct ctdb_req_header * hdr ,
2007-05-19 07:45:24 +04:00
void ( * recv_pkt ) ( void * , struct ctdb_req_header * ) ,
2007-05-12 12:08:50 +04:00
void * recv_context , bool ignore_generation ) ;
2007-04-16 17:52:14 +04:00
int ctdb_ltdb_lock_fetch_requeue ( struct ctdb_db_context * ctdb_db ,
TDB_DATA key , struct ctdb_ltdb_header * header ,
2007-04-19 10:27:56 +04:00
struct ctdb_req_header * hdr , TDB_DATA * data ,
2007-05-19 07:45:24 +04:00
void ( * recv_pkt ) ( void * , struct ctdb_req_header * ) ,
2007-05-12 12:08:50 +04:00
void * recv_context , bool ignore_generation ) ;
2007-05-19 07:45:24 +04:00
void ctdb_input_pkt ( struct ctdb_context * ctdb , struct ctdb_req_header * ) ;
2006-12-18 05:24:02 +03:00
2007-04-09 05:51:27 +04:00
struct ctdb_call_state * ctdb_call_local_send ( struct ctdb_db_context * ctdb_db ,
struct ctdb_call * call ,
struct ctdb_ltdb_header * header ,
TDB_DATA * data ) ;
2006-12-18 05:24:02 +03:00
2007-04-10 00:03:39 +04:00
int ctdbd_start ( struct ctdb_context * ctdb ) ;
struct ctdb_call_state * ctdbd_call_send ( struct ctdb_db_context * ctdb_db , struct ctdb_call * call ) ;
int ctdbd_call_recv ( struct ctdb_call_state * state , struct ctdb_call * call ) ;
2007-04-10 13:33:21 +04:00
/*
queue a packet for sending
*/
int ctdb_queue_send ( struct ctdb_queue * queue , uint8_t * data , uint32_t length ) ;
/*
setup the fd used by the queue
*/
int ctdb_queue_set_fd ( struct ctdb_queue * queue , int fd ) ;
/*
setup a packet queue on a socket
*/
struct ctdb_queue * ctdb_queue_setup ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx , int fd , int alignment ,
ctdb_queue_cb_fn_t callback ,
2007-04-11 22:12:15 +04:00
void * private_data ) ;
2007-04-10 13:33:21 +04:00
2007-04-11 05:01:42 +04:00
/*
allocate a packet for use in client < - > daemon communication
*/
2007-04-28 12:50:32 +04:00
struct ctdb_req_header * _ctdbd_allocate_pkt ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
enum ctdb_operation operation ,
size_t length , size_t slength ,
const char * type ) ;
# define ctdbd_allocate_pkt(ctdb, mem_ctx, operation, length, type) \
( type * ) _ctdbd_allocate_pkt ( ctdb , mem_ctx , operation , length , sizeof ( type ) , # type )
struct ctdb_req_header * _ctdb_transport_allocate ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
enum ctdb_operation operation ,
size_t length , size_t slength ,
const char * type ) ;
# define ctdb_transport_allocate(ctdb, mem_ctx, operation, length, type) \
( type * ) _ctdb_transport_allocate ( ctdb , mem_ctx , operation , length , sizeof ( type ) , # type )
2007-04-11 05:01:42 +04:00
2009-10-21 08:20:55 +04:00
int ctdb_queue_length ( struct ctdb_queue * queue ) ;
2007-04-11 05:01:42 +04:00
/*
lock a record in the ltdb , given a key
*/
int ctdb_ltdb_lock ( struct ctdb_db_context * ctdb_db , TDB_DATA key ) ;
/*
unlock a record in the ltdb , given a key
*/
int ctdb_ltdb_unlock ( struct ctdb_db_context * ctdb_db , TDB_DATA key ) ;
/*
make a ctdb call to the local daemon - async send . Called from client context .
2007-04-10 13:33:21 +04:00
2007-04-11 05:01:42 +04:00
This constructs a ctdb_call request and queues it for processing .
This call never blocks .
*/
struct ctdb_call_state * ctdb_client_call_send ( struct ctdb_db_context * ctdb_db ,
struct ctdb_call * call ) ;
/*
make a recv call to the local ctdb daemon - called from client context
This is called when the program wants to wait for a ctdb_call to complete and get the
results . This call will block unless the call has already completed .
*/
int ctdb_client_call_recv ( struct ctdb_call_state * state , struct ctdb_call * call ) ;
2007-04-10 00:03:39 +04:00
2007-04-27 18:31:45 +04:00
int ctdb_daemon_set_message_handler ( struct ctdb_context * ctdb , uint64_t srvid ,
2007-04-11 07:43:15 +04:00
ctdb_message_fn_t handler ,
2007-04-11 22:12:15 +04:00
void * private_data ) ;
2007-04-11 07:43:15 +04:00
int ctdb_client_send_message ( struct ctdb_context * ctdb , uint32_t vnn ,
2007-04-27 18:31:45 +04:00
uint64_t srvid , TDB_DATA data ) ;
2007-04-11 07:43:15 +04:00
2007-04-11 08:05:01 +04:00
/*
send a ctdb message
*/
2007-09-04 04:45:41 +04:00
int ctdb_daemon_send_message ( struct ctdb_context * ctdb , uint32_t pnn ,
2007-04-27 18:31:45 +04:00
uint64_t srvid , TDB_DATA data ) ;
2007-04-11 08:05:01 +04:00
2007-04-11 08:26:14 +04:00
2007-04-16 17:52:14 +04:00
struct lockwait_handle * ctdb_lockwait ( struct ctdb_db_context * ctdb_db ,
TDB_DATA key ,
void ( * callback ) ( void * ) , void * private_data ) ;
2007-04-17 08:52:51 +04:00
struct ctdb_call_state * ctdb_daemon_call_send ( struct ctdb_db_context * ctdb_db ,
struct ctdb_call * call ) ;
int ctdb_daemon_call_recv ( struct ctdb_call_state * state , struct ctdb_call * call ) ;
2007-04-17 10:20:32 +04:00
struct ctdb_call_state * ctdb_daemon_call_send_remote ( struct ctdb_db_context * ctdb_db ,
struct ctdb_call * call ,
struct ctdb_ltdb_header * header ) ;
2007-04-19 05:28:01 +04:00
int ctdb_call_local ( struct ctdb_db_context * ctdb_db , struct ctdb_call * call ,
2007-05-16 12:10:26 +04:00
struct ctdb_ltdb_header * header , TALLOC_CTX * mem_ctx , TDB_DATA * data ,
2007-04-19 05:28:01 +04:00
uint32_t caller ) ;
2007-04-23 12:19:50 +04:00
# define ctdb_reqid_find(ctdb, reqid, type) (type *)_ctdb_reqid_find(ctdb, reqid, #type, __location__)
2007-04-19 05:28:01 +04:00
2007-04-19 10:27:56 +04:00
void ctdb_recv_raw_pkt ( void * p , uint8_t * data , uint32_t length ) ;
2007-04-20 14:07:47 +04:00
int ctdb_socket_connect ( struct ctdb_context * ctdb ) ;
2008-10-30 04:49:53 +03:00
void ctdb_latency ( struct ctdb_db_context * ctdb_db , const char * name , double * latency , struct timeval t ) ;
2009-05-14 04:33:25 +04:00
void ctdb_reclock_latency ( struct ctdb_context * ctdb , const char * name , double * latency , double l ) ;
2007-04-20 14:07:47 +04:00
2007-04-23 12:19:50 +04:00
uint32_t ctdb_reqid_new ( struct ctdb_context * ctdb , void * state ) ;
void * _ctdb_reqid_find ( struct ctdb_context * ctdb , uint32_t reqid , const char * type , const char * location ) ;
void ctdb_reqid_remove ( struct ctdb_context * ctdb , uint32_t reqid ) ;
2007-04-26 16:27:49 +04:00
void ctdb_request_control ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
void ctdb_reply_control ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
int ctdb_daemon_send_control ( struct ctdb_context * ctdb , uint32_t destnode ,
2007-05-04 05:41:29 +04:00
uint64_t srvid , uint32_t opcode , uint32_t client_id , uint32_t flags ,
2007-04-30 17:31:40 +04:00
TDB_DATA data ,
2007-04-26 16:27:49 +04:00
ctdb_control_callback_fn_t callback ,
void * private_data ) ;
2007-04-30 17:31:40 +04:00
int32_t ctdb_control_db_attach ( struct ctdb_context * ctdb , TDB_DATA indata ,
2008-05-12 07:37:31 +04:00
TDB_DATA * outdata , uint64_t tdb_flags , bool persistent ) ;
2007-04-30 17:31:40 +04:00
int ctdb_daemon_set_call ( struct ctdb_context * ctdb , uint32_t db_id ,
ctdb_fn_t fn , int id ) ;
2007-05-02 06:43:35 +04:00
int ctdb_control ( struct ctdb_context * ctdb , uint32_t destnode , uint64_t srvid ,
uint32_t opcode , uint32_t flags , TDB_DATA data ,
2007-05-04 02:30:18 +04:00
TALLOC_CTX * mem_ctx , TDB_DATA * outdata , int32_t * status ,
2007-05-12 15:25:26 +04:00
struct timeval * timeout , char * * errormsg ) ;
2007-08-23 13:27:09 +04:00
int ctdb_control_recv ( struct ctdb_context * ctdb ,
struct ctdb_client_control_state * state ,
TALLOC_CTX * mem_ctx ,
TDB_DATA * outdata , int32_t * status , char * * errormsg ) ;
struct ctdb_client_control_state *
ctdb_control_send ( struct ctdb_context * ctdb ,
uint32_t destnode , uint64_t srvid ,
uint32_t opcode , uint32_t flags , TDB_DATA data ,
2008-01-16 02:23:26 +03:00
TALLOC_CTX * mem_ctx ,
2007-08-23 13:27:09 +04:00
struct timeval * timeout ,
2007-08-24 04:42:06 +04:00
char * * errormsg ) ;
2007-05-02 06:43:35 +04:00
2007-05-03 05:06:24 +04:00
# define CHECK_CONTROL_DATA_SIZE(size) do { \
if ( indata . dsize ! = size ) { \
DEBUG ( 0 , ( __location__ " Invalid data size in opcode %u. Got %u expected %u \n " , \
2007-05-29 07:58:41 +04:00
opcode , ( unsigned ) indata . dsize , ( unsigned ) size ) ) ; \
2007-05-03 05:06:24 +04:00
return - 1 ; \
} \
} while ( 0 )
int ctdb_control_getvnnmap ( struct ctdb_context * ctdb , uint32_t opcode , TDB_DATA indata , TDB_DATA * outdata ) ;
int ctdb_control_setvnnmap ( struct ctdb_context * ctdb , uint32_t opcode , TDB_DATA indata , TDB_DATA * outdata ) ;
2007-05-03 07:07:34 +04:00
int ctdb_control_getdbmap ( struct ctdb_context * ctdb , uint32_t opcode , TDB_DATA indata , TDB_DATA * outdata ) ;
2008-10-14 03:40:29 +04:00
int ctdb_control_getnodemapv4 ( struct ctdb_context * ctdb , uint32_t opcode , TDB_DATA indata , TDB_DATA * outdata ) ;
2007-05-03 07:30:38 +04:00
int ctdb_control_getnodemap ( struct ctdb_context * ctdb , uint32_t opcode , TDB_DATA indata , TDB_DATA * outdata ) ;
2007-05-03 10:18:03 +04:00
int ctdb_control_writerecord ( struct ctdb_context * ctdb , uint32_t opcode , TDB_DATA indata , TDB_DATA * outdata ) ;
2007-05-03 05:06:24 +04:00
2007-05-03 11:12:23 +04:00
struct ctdb_traverse_start {
uint32_t db_id ;
uint32_t reqid ;
uint64_t srvid ;
} ;
/*
2007-05-10 11:43:45 +04:00
structure used to pass record data between the child and parent
2007-05-03 11:12:23 +04:00
*/
2007-05-10 11:43:45 +04:00
struct ctdb_rec_data {
2007-05-03 11:12:23 +04:00
uint32_t length ;
uint32_t reqid ;
uint32_t keylen ;
uint32_t datalen ;
uint8_t data [ 1 ] ;
} ;
2007-05-10 11:43:45 +04:00
/* structure used for pulldb control */
struct ctdb_control_pulldb {
uint32_t db_id ;
uint32_t lmaster ;
} ;
2008-07-30 08:24:56 +04:00
/* structure used for sending lists of records */
struct ctdb_marshall_buffer {
2007-05-10 11:43:45 +04:00
uint32_t db_id ;
uint32_t count ;
uint8_t data [ 1 ] ;
} ;
/* set dmaster control structure */
struct ctdb_control_set_dmaster {
uint32_t db_id ;
uint32_t dmaster ;
} ;
2007-06-04 13:53:19 +04:00
/*
structure for setting a tunable
*/
struct ctdb_control_set_tunable {
uint32_t value ;
uint32_t length ;
uint8_t name [ 1 ] ;
} ;
/*
structure for getting a tunable
*/
struct ctdb_control_get_tunable {
uint32_t length ;
uint8_t name [ 1 ] ;
} ;
/*
structure for listing tunables
*/
struct ctdb_control_list_tunable {
uint32_t length ;
/* returns a : separated list of tunable names */
uint8_t data [ 1 ] ;
} ;
2007-06-04 07:26:07 +04:00
/* table that contains a list of all nodes a ctdb knows about and their
status
*/
struct ctdb_node_and_flags {
2007-09-04 03:50:07 +04:00
uint32_t pnn ;
2007-06-04 07:26:07 +04:00
uint32_t flags ;
2008-08-19 08:58:29 +04:00
ctdb_sock_addr addr ;
2007-06-04 07:26:07 +04:00
} ;
struct ctdb_node_map {
uint32_t num ;
struct ctdb_node_and_flags nodes [ 1 ] ;
} ;
2008-10-14 03:40:29 +04:00
struct ctdb_node_and_flagsv4 {
uint32_t pnn ;
uint32_t flags ;
struct sockaddr_in sin ;
} ;
struct ctdb_node_mapv4 {
uint32_t num ;
struct ctdb_node_and_flagsv4 nodes [ 1 ] ;
} ;
2008-01-06 05:24:55 +03:00
struct ctdb_control_wipe_database {
uint32_t db_id ;
uint32_t transaction_id ;
} ;
2008-01-08 13:28:42 +03:00
/*
state of a in - progress ctdb call in client
*/
struct ctdb_client_call_state {
enum call_state state ;
uint32_t reqid ;
struct ctdb_db_context * ctdb_db ;
2008-03-19 05:54:17 +03:00
struct ctdb_call * call ;
2008-01-08 13:28:42 +03:00
struct {
void ( * fn ) ( struct ctdb_client_call_state * ) ;
2008-07-22 03:07:42 +04:00
void * private_data ;
2008-01-08 13:28:42 +03:00
} async ;
} ;
2007-05-03 11:12:23 +04:00
int32_t ctdb_control_traverse_start ( struct ctdb_context * ctdb , TDB_DATA indata ,
2009-05-06 01:32:25 +04:00
TDB_DATA * outdata , uint32_t srcnode , uint32_t client_id ) ;
2007-05-03 11:12:23 +04:00
int32_t ctdb_control_traverse_all ( struct ctdb_context * ctdb , TDB_DATA data , TDB_DATA * outdata ) ;
int32_t ctdb_control_traverse_data ( struct ctdb_context * ctdb , TDB_DATA data , TDB_DATA * outdata ) ;
2009-05-06 01:32:25 +04:00
int32_t ctdb_control_traverse_kill ( struct ctdb_context * ctdb , TDB_DATA indata ,
TDB_DATA * outdata , uint32_t srcnode ) ;
2007-05-03 11:12:23 +04:00
int ctdb_dispatch_message ( struct ctdb_context * ctdb , uint64_t srvid , TDB_DATA data ) ;
2007-05-04 05:41:29 +04:00
int daemon_register_message_handler ( struct ctdb_context * ctdb , uint32_t client_id , uint64_t srvid ) ;
int ctdb_deregister_message_handler ( struct ctdb_context * ctdb , uint64_t srvid , void * private_data ) ;
int daemon_deregister_message_handler ( struct ctdb_context * ctdb , uint32_t client_id , uint64_t srvid ) ;
2007-05-03 11:12:23 +04:00
2007-05-04 16:18:00 +04:00
int32_t ctdb_ltdb_enable_seqnum ( struct ctdb_context * ctdb , uint32_t db_id ) ;
int32_t ctdb_ltdb_update_seqnum ( struct ctdb_context * ctdb , uint32_t db_id , uint32_t srcnode ) ;
2007-09-21 06:24:02 +04:00
struct ctdb_rec_data * ctdb_marshall_record ( TALLOC_CTX * mem_ctx , uint32_t reqid ,
TDB_DATA key , struct ctdb_ltdb_header * , TDB_DATA data ) ;
2007-05-10 11:43:45 +04:00
2008-07-30 13:57:00 +04:00
struct ctdb_rec_data * ctdb_marshall_loop_next ( struct ctdb_marshall_buffer * m , struct ctdb_rec_data * r ,
uint32_t * reqid ,
struct ctdb_ltdb_header * header ,
TDB_DATA * key , TDB_DATA * data ) ;
2007-05-10 11:43:45 +04:00
int32_t ctdb_control_pull_db ( struct ctdb_context * ctdb , TDB_DATA indata , TDB_DATA * outdata ) ;
int32_t ctdb_control_push_db ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_set_dmaster ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2007-06-02 02:41:19 +04:00
int32_t ctdb_control_set_recmode ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA indata , bool * async_reply ,
const char * * errormsg ) ;
2007-05-12 08:34:21 +04:00
void ctdb_request_control_reply ( struct ctdb_context * ctdb , struct ctdb_req_control * c ,
2007-05-12 15:25:26 +04:00
TDB_DATA * outdata , int32_t status , const char * errormsg ) ;
2007-05-12 08:34:21 +04:00
2007-05-12 09:15:27 +04:00
int32_t ctdb_control_freeze ( struct ctdb_context * ctdb , struct ctdb_req_control * c , bool * async_reply ) ;
2009-10-12 05:08:39 +04:00
int32_t ctdb_control_thaw ( struct ctdb_context * ctdb , uint32_t priority ) ;
2007-05-12 09:15:27 +04:00
2007-05-15 09:13:36 +04:00
int ctdb_start_recoverd ( struct ctdb_context * ctdb ) ;
2007-10-22 06:34:08 +04:00
void ctdb_stop_recoverd ( struct ctdb_context * ctdb ) ;
2007-05-15 09:13:36 +04:00
2007-06-18 21:54:06 +04:00
uint32_t ctdb_get_num_active_nodes ( struct ctdb_context * ctdb ) ;
2007-05-17 17:23:41 +04:00
2007-11-30 02:09:54 +03:00
void ctdb_disable_monitoring ( struct ctdb_context * ctdb ) ;
void ctdb_enable_monitoring ( struct ctdb_context * ctdb ) ;
2007-06-06 07:45:12 +04:00
void ctdb_stop_monitoring ( struct ctdb_context * ctdb ) ;
void ctdb_start_monitoring ( struct ctdb_context * ctdb ) ;
2007-07-20 09:05:55 +04:00
void ctdb_start_tcp_tickle_update ( struct ctdb_context * ctdb ) ;
2007-05-18 17:23:36 +04:00
void ctdb_send_keepalive ( struct ctdb_context * ctdb , uint32_t destnode ) ;
2008-01-15 00:42:12 +03:00
void ctdb_start_keepalive ( struct ctdb_context * ctdb ) ;
void ctdb_stop_keepalive ( struct ctdb_context * ctdb ) ;
2008-04-02 04:13:30 +04:00
int32_t ctdb_run_eventscripts ( struct ctdb_context * ctdb , struct ctdb_req_control * c , TDB_DATA data , bool * async_reply ) ;
2007-05-18 13:19:35 +04:00
2007-05-18 17:48:29 +04:00
void ctdb_daemon_cancel_controls ( struct ctdb_context * ctdb , struct ctdb_node * node ) ;
2007-05-18 18:56:49 +04:00
void ctdb_call_resend_all ( struct ctdb_context * ctdb ) ;
2007-05-19 10:59:10 +04:00
void ctdb_node_dead ( struct ctdb_node * node ) ;
2007-05-19 11:21:58 +04:00
void ctdb_node_connected ( struct ctdb_node * node ) ;
2007-05-23 06:23:07 +04:00
bool ctdb_blocking_freeze ( struct ctdb_context * ctdb ) ;
2009-12-16 11:56:22 +03:00
void ctdb_high_priority ( struct ctdb_context * ctdb ) ;
2007-06-01 13:05:41 +04:00
int32_t ctdb_control_takeover_ip ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA indata ,
bool * async_reply ) ;
2008-10-14 03:40:29 +04:00
int32_t ctdb_control_takeover_ipv4 ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA indata ,
bool * async_reply ) ;
2007-06-01 13:05:41 +04:00
int32_t ctdb_control_release_ip ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA indata ,
bool * async_reply ) ;
2008-10-14 03:40:29 +04:00
int32_t ctdb_control_release_ipv4 ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA indata ,
bool * async_reply ) ;
2008-01-29 05:59:28 +03:00
int32_t ctdb_control_start_recovery ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
bool * async_reply ) ;
int32_t ctdb_control_end_recovery ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
bool * async_reply ) ;
2007-06-04 14:07:37 +04:00
2008-10-14 03:40:29 +04:00
struct ctdb_public_ipv4 {
uint32_t pnn ;
struct sockaddr_in sin ;
} ;
2007-06-04 14:07:37 +04:00
struct ctdb_public_ip {
2007-09-04 03:50:07 +04:00
uint32_t pnn ;
2008-08-19 08:58:29 +04:00
ctdb_sock_addr addr ;
2007-06-04 14:07:37 +04:00
} ;
int ctdb_ctrl_takeover_ip ( struct ctdb_context * ctdb , struct timeval timeout ,
uint32_t destnode , struct ctdb_public_ip * ip ) ;
2007-05-25 07:05:25 +04:00
int ctdb_ctrl_release_ip ( struct ctdb_context * ctdb , struct timeval timeout ,
2007-06-04 14:07:37 +04:00
uint32_t destnode , struct ctdb_public_ip * ip ) ;
2007-05-25 11:04:13 +04:00
2008-10-14 03:40:29 +04:00
struct ctdb_all_public_ipsv4 {
uint32_t num ;
struct ctdb_public_ipv4 ips [ 1 ] ;
} ;
2007-06-04 15:11:51 +04:00
struct ctdb_all_public_ips {
uint32_t num ;
struct ctdb_public_ip ips [ 1 ] ;
} ;
2008-10-14 03:40:29 +04:00
int32_t ctdb_control_get_public_ipsv4 ( struct ctdb_context * ctdb , struct ctdb_req_control * c , TDB_DATA * outdata ) ;
2007-06-04 15:11:51 +04:00
int32_t ctdb_control_get_public_ips ( struct ctdb_context * ctdb , struct ctdb_req_control * c , TDB_DATA * outdata ) ;
int ctdb_ctrl_get_public_ips ( struct ctdb_context * ctdb ,
2009-12-16 17:50:06 +03:00
struct timeval timeout ,
uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
struct ctdb_all_public_ips * * ips ) ;
# define CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE 0x00010000
int ctdb_ctrl_get_public_ips_flags ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
uint32_t flags ,
struct ctdb_all_public_ips * * ips ) ;
2008-10-14 03:40:29 +04:00
int ctdb_ctrl_get_public_ipsv4 ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx , struct ctdb_all_public_ips * * ips ) ;
2007-06-04 15:11:51 +04:00
2009-12-16 16:40:21 +03:00
# ifdef IFNAMSIZ
# define CTDB_IFACE_SIZE IFNAMSIZ
# else
# define CTDB_IFACE_SIZE 16
# endif
struct ctdb_control_iface_info {
char name [ CTDB_IFACE_SIZE + 2 ] ;
uint16_t link_state ;
uint32_t references ;
} ;
struct ctdb_control_public_ip_info {
struct ctdb_public_ip ip ;
uint32_t active_idx ;
uint32_t num ;
struct ctdb_control_iface_info ifaces [ 1 ] ;
} ;
struct ctdb_control_get_ifaces {
uint32_t num ;
struct ctdb_control_iface_info ifaces [ 1 ] ;
} ;
int32_t ctdb_control_get_public_ip_info ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA indata ,
TDB_DATA * outdata ) ;
int32_t ctdb_control_get_ifaces ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA * outdata ) ;
int32_t ctdb_control_set_iface_link ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA indata ) ;
int ctdb_ctrl_get_public_ip_info ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
const ctdb_sock_addr * addr ,
struct ctdb_control_public_ip_info * * info ) ;
int ctdb_ctrl_get_ifaces ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
struct ctdb_control_get_ifaces * * ifaces ) ;
int ctdb_ctrl_set_iface_link ( struct ctdb_context * ctdb ,
struct timeval timeout , uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
const struct ctdb_control_iface_info * info ) ;
2007-05-25 11:04:13 +04:00
/* from takeover/system.c */
2009-02-28 05:08:31 +03:00
uint32_t uint16_checksum ( uint16_t * data , size_t n ) ;
2008-06-04 09:13:00 +04:00
int ctdb_sys_send_arp ( const ctdb_sock_addr * addr , const char * iface ) ;
2008-08-19 08:58:29 +04:00
bool ctdb_sys_have_ip ( ctdb_sock_addr * addr ) ;
2008-05-14 09:47:47 +04:00
int ctdb_sys_send_tcp ( const ctdb_sock_addr * dest ,
const ctdb_sock_addr * src ,
2007-07-04 07:32:38 +04:00
uint32_t seq , uint32_t ack , int rst ) ;
2007-05-25 11:04:13 +04:00
int ctdb_set_public_addresses ( struct ctdb_context * ctdb , const char * alist ) ;
2009-12-14 21:33:35 +03:00
int ctdb_set_single_public_ip ( struct ctdb_context * ctdb ,
const char * iface ,
const char * ip ) ;
2007-05-29 06:49:25 +04:00
int ctdb_set_event_script ( struct ctdb_context * ctdb , const char * script ) ;
2007-08-15 08:44:03 +04:00
int ctdb_set_event_script_dir ( struct ctdb_context * ctdb , const char * script_dir ) ;
2009-03-31 07:23:31 +04:00
int ctdb_set_notification_script ( struct ctdb_context * ctdb , const char * script ) ;
2007-05-25 11:04:13 +04:00
int ctdb_takeover_run ( struct ctdb_context * ctdb , struct ctdb_node_map * nodemap ) ;
2007-05-18 17:48:29 +04:00
2007-05-27 09:26:29 +04:00
int32_t ctdb_control_tcp_client ( struct ctdb_context * ctdb , uint32_t client_id ,
2007-07-20 04:06:41 +04:00
TDB_DATA indata ) ;
2007-05-27 09:26:29 +04:00
int32_t ctdb_control_tcp_add ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_tcp_remove ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2007-05-27 18:34:40 +04:00
int32_t ctdb_control_startup ( struct ctdb_context * ctdb , uint32_t vnn ) ;
2007-07-11 12:24:25 +04:00
int32_t ctdb_control_kill_tcp ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2007-10-09 05:56:09 +04:00
int32_t ctdb_control_send_gratious_arp ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2007-07-20 09:05:55 +04:00
int32_t ctdb_control_get_tcp_tickle_list ( struct ctdb_context * ctdb , TDB_DATA indata , TDB_DATA * outdata ) ;
int32_t ctdb_control_set_tcp_tickle_list ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2007-05-27 09:26:29 +04:00
void ctdb_takeover_client_destructor_hook ( struct ctdb_client * client ) ;
2009-11-24 03:46:49 +03:00
int ctdb_event_script ( struct ctdb_context * ctdb , enum ctdb_eventscript_call call ) ;
int ctdb_event_script_args ( struct ctdb_context * ctdb , enum ctdb_eventscript_call call ,
const char * fmt , . . . ) PRINTF_ATTRIBUTE ( 3 , 4 ) ;
2007-05-30 07:26:50 +04:00
int ctdb_event_script_callback ( struct ctdb_context * ctdb ,
2007-06-01 13:05:41 +04:00
TALLOC_CTX * mem_ctx ,
void ( * callback ) ( struct ctdb_context * , int , void * ) ,
void * private_data ,
2009-11-26 07:49:49 +03:00
bool from_user ,
2009-11-24 03:46:49 +03:00
enum ctdb_eventscript_call call ,
2009-11-26 07:49:49 +03:00
const char * fmt , . . . ) PRINTF_ATTRIBUTE ( 7 , 8 ) ;
2007-05-29 07:33:59 +04:00
void ctdb_release_all_ips ( struct ctdb_context * ctdb ) ;
2007-05-29 06:49:25 +04:00
2007-05-30 09:43:25 +04:00
void set_nonblocking ( int fd ) ;
void set_close_on_exec ( int fd ) ;
2007-05-29 07:48:30 +04:00
2007-06-02 05:36:42 +04:00
bool ctdb_recovery_lock ( struct ctdb_context * ctdb , bool keep ) ;
2007-06-02 04:03:28 +04:00
2007-06-02 05:36:42 +04:00
int ctdb_set_recovery_lock_file ( struct ctdb_context * ctdb , const char * file ) ;
2007-05-29 07:48:30 +04:00
2007-06-04 13:53:19 +04:00
int32_t ctdb_control_get_tunable ( struct ctdb_context * ctdb , TDB_DATA indata ,
TDB_DATA * outdata ) ;
int32_t ctdb_control_set_tunable ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_list_tunables ( struct ctdb_context * ctdb , TDB_DATA * outdata ) ;
2008-03-12 23:53:29 +03:00
int32_t ctdb_control_try_delete_records ( struct ctdb_context * ctdb , TDB_DATA indata , TDB_DATA * outdata ) ;
2008-03-27 01:23:27 +03:00
int32_t ctdb_control_add_public_address ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_del_public_address ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2007-06-04 13:53:19 +04:00
2007-06-04 14:22:44 +04:00
void ctdb_tunables_set_defaults ( struct ctdb_context * ctdb ) ;
2007-06-07 09:18:55 +04:00
int32_t ctdb_control_modflags ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2007-06-07 05:15:22 +04:00
2007-06-07 12:05:25 +04:00
int ctdb_ctrl_get_all_tunables ( struct ctdb_context * ctdb ,
struct timeval timeout ,
uint32_t destnode ,
struct ctdb_tunable * tunables ) ;
2009-10-12 05:08:39 +04:00
int ctdb_start_freeze ( struct ctdb_context * ctdb , uint32_t priority ) ;
2007-06-10 02:46:33 +04:00
2009-01-19 17:33:24 +03:00
bool parse_ip_mask ( const char * s , const char * iface , ctdb_sock_addr * addr , unsigned * mask ) ;
2008-08-19 08:58:29 +04:00
bool parse_ip_port ( const char * s , ctdb_sock_addr * addr ) ;
2009-03-24 05:45:11 +03:00
bool parse_ip ( const char * s , const char * iface , unsigned port , ctdb_sock_addr * addr ) ;
2008-10-14 03:40:29 +04:00
bool parse_ipv4 ( const char * s , unsigned port , struct sockaddr_in * sin ) ;
2008-08-19 08:58:29 +04:00
2007-07-04 10:51:13 +04:00
2007-07-13 11:07:10 +04:00
int ctdb_sys_open_capture_socket ( const char * iface , void * * private_data ) ;
int ctdb_sys_close_capture_socket ( void * private_data ) ;
2008-08-19 08:58:29 +04:00
int ctdb_sys_read_tcp_packet ( int s , void * private_data , ctdb_sock_addr * src , ctdb_sock_addr * dst , uint32_t * ack_seq , uint32_t * seq ) ;
2007-07-11 06:33:14 +04:00
2007-07-12 02:30:04 +04:00
int ctdb_ctrl_killtcp ( struct ctdb_context * ctdb ,
struct timeval timeout ,
uint32_t destnode ,
struct ctdb_control_killtcp * killtcp ) ;
2008-03-27 01:23:27 +03:00
int ctdb_ctrl_add_public_ip ( struct ctdb_context * ctdb ,
struct timeval timeout ,
uint32_t destnode ,
struct ctdb_control_ip_iface * pub ) ;
int ctdb_ctrl_del_public_ip ( struct ctdb_context * ctdb ,
struct timeval timeout ,
uint32_t destnode ,
struct ctdb_control_ip_iface * pub ) ;
2007-10-09 05:56:09 +04:00
int ctdb_ctrl_gratious_arp ( struct ctdb_context * ctdb ,
struct timeval timeout ,
uint32_t destnode ,
2008-06-04 09:13:00 +04:00
ctdb_sock_addr * addr ,
2007-10-09 05:56:09 +04:00
const char * ifname ) ;
2007-07-20 09:05:55 +04:00
int ctdb_ctrl_get_tcp_tickles ( struct ctdb_context * ctdb ,
struct timeval timeout ,
uint32_t destnode ,
TALLOC_CTX * mem_ctx ,
2008-08-19 08:58:29 +04:00
ctdb_sock_addr * addr ,
2007-07-20 09:05:55 +04:00
struct ctdb_control_tcp_tickle_list * * list ) ;
2007-07-12 02:30:04 +04:00
2007-08-24 09:53:41 +04:00
int32_t ctdb_control_register_server_id ( struct ctdb_context * ctdb ,
uint32_t client_id ,
TDB_DATA indata ) ;
int32_t ctdb_control_check_server_id ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
int32_t ctdb_control_unregister_server_id ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
2007-08-26 04:57:02 +04:00
int32_t ctdb_control_get_server_id_list ( struct ctdb_context * ctdb ,
TDB_DATA * outdata ) ;
2008-01-17 03:33:23 +03:00
int32_t ctdb_control_uptime ( struct ctdb_context * ctdb ,
TDB_DATA * outdata ) ;
2007-08-24 09:53:41 +04:00
2009-11-29 14:39:23 +03:00
int ctdb_attach_databases ( struct ctdb_context * ctdb ) ;
2007-09-21 06:24:02 +04:00
int32_t ctdb_control_persistent_store ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA recdata , bool * async_reply ) ;
int32_t ctdb_control_update_record ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c , TDB_DATA recdata ,
bool * async_reply ) ;
2008-07-30 13:57:00 +04:00
int32_t ctdb_control_trans2_commit ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA recdata , bool * async_reply ) ;
2007-09-21 06:24:02 +04:00
2009-12-03 19:59:49 +03:00
int32_t ctdb_control_trans3_commit ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ,
TDB_DATA recdata , bool * async_reply ) ;
2008-01-06 05:24:55 +03:00
int32_t ctdb_control_transaction_start ( struct ctdb_context * ctdb , uint32_t id ) ;
int32_t ctdb_control_transaction_commit ( struct ctdb_context * ctdb , uint32_t id ) ;
2009-10-12 09:48:05 +04:00
int32_t ctdb_control_transaction_cancel ( struct ctdb_context * ctdb ) ;
2008-01-06 04:38:01 +03:00
int32_t ctdb_control_wipe_database ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2009-12-02 14:48:22 +03:00
int32_t ctdb_control_db_set_healthy ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_db_get_health ( struct ctdb_context * ctdb ,
TDB_DATA indata ,
TDB_DATA * outdata ) ;
2007-09-21 06:24:02 +04:00
2008-01-08 09:23:27 +03:00
int ctdb_vacuum ( struct ctdb_context * ctdb , int argc , const char * * argv ) ;
int ctdb_repack ( struct ctdb_context * ctdb , int argc , const char * * argv ) ;
2008-01-10 01:43:14 +03:00
void ctdb_block_signal ( int signum ) ;
void ctdb_unblock_signal ( int signum ) ;
2008-01-10 06:40:56 +03:00
int32_t ctdb_monitoring_mode ( struct ctdb_context * ctdb ) ;
2008-01-16 14:03:01 +03:00
int ctdb_set_child_logging ( struct ctdb_context * ctdb ) ;
2009-12-16 13:27:20 +03:00
void ctdb_lockdown_memory ( struct ctdb_context * ctdb ) ;
2008-01-29 05:59:28 +03:00
2008-06-12 10:53:36 +04:00
typedef void ( * client_async_callback ) ( struct ctdb_context * ctdb , uint32_t node_pnn , int32_t res , TDB_DATA outdata , void * callback_data ) ;
2008-05-06 09:42:59 +04:00
2008-01-29 05:59:28 +03:00
struct client_async_data {
2008-07-02 06:21:53 +04:00
enum ctdb_controls opcode ;
2008-01-29 05:59:28 +03:00
bool dont_log_errors ;
uint32_t count ;
uint32_t fail_count ;
2008-05-06 09:42:59 +04:00
client_async_callback callback ;
2008-06-12 10:53:36 +04:00
client_async_callback fail_callback ;
void * callback_data ;
2008-01-29 05:59:28 +03:00
} ;
void ctdb_client_async_add ( struct client_async_data * data , struct ctdb_client_control_state * state ) ;
int ctdb_client_async_wait ( struct ctdb_context * ctdb , struct client_async_data * data ) ;
int ctdb_client_async_control ( struct ctdb_context * ctdb ,
enum ctdb_controls opcode ,
uint32_t * nodes ,
2009-10-12 05:08:39 +04:00
uint64_t srvid ,
2008-01-29 05:59:28 +03:00
struct timeval timeout ,
bool dont_log_errors ,
2008-05-06 09:42:59 +04:00
TDB_DATA data ,
2008-06-12 10:53:36 +04:00
client_async_callback client_callback ,
client_async_callback fail_callback ,
void * callback_data ) ;
2008-01-29 05:59:28 +03:00
2008-02-19 06:44:48 +03:00
void ctdb_load_nodes_file ( struct ctdb_context * ctdb ) ;
int ctdb_control_reload_nodes_file ( struct ctdb_context * ctdb , uint32_t opcode ) ;
2008-04-01 08:34:54 +04:00
int32_t ctdb_dump_memory ( struct ctdb_context * ctdb , TDB_DATA * outdata ) ;
2008-05-06 09:42:59 +04:00
int32_t ctdb_control_get_capabilities ( struct ctdb_context * ctdb , TDB_DATA * outdata ) ;
2008-01-29 05:59:28 +03:00
2008-07-30 13:57:00 +04:00
int32_t ctdb_control_trans2_finished ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ) ;
int32_t ctdb_control_trans2_error ( struct ctdb_context * ctdb ,
struct ctdb_req_control * c ) ;
2009-10-29 02:49:00 +03:00
int32_t ctdb_control_trans2_active ( struct ctdb_context * ctdb ,
2009-10-29 19:08:37 +03:00
struct ctdb_req_control * c ,
2009-10-29 02:49:00 +03:00
uint32_t db_id ) ;
2008-07-30 13:57:00 +04:00
2008-08-19 08:58:29 +04:00
char * ctdb_addr_to_str ( ctdb_sock_addr * addr ) ;
2009-03-24 05:45:11 +03:00
unsigned ctdb_addr_to_port ( ctdb_sock_addr * addr ) ;
2008-08-20 05:58:27 +04:00
void ctdb_canonicalize_ip ( const ctdb_sock_addr * ip , ctdb_sock_addr * cip ) ;
2008-09-09 07:44:46 +04:00
int32_t ctdb_control_recd_ping ( struct ctdb_context * ctdb ) ;
2008-10-22 04:04:41 +04:00
int32_t ctdb_control_set_recmaster ( struct ctdb_context * ctdb , uint32_t opcode , TDB_DATA indata ) ;
2008-08-19 08:58:29 +04:00
2008-10-17 00:56:12 +04:00
extern int script_log_level ;
2009-12-07 18:20:55 +03:00
int32_t ctdb_control_get_event_script_status ( struct ctdb_context * ctdb ,
uint32_t call_type ,
TDB_DATA * outdata ) ;
2009-03-23 11:07:45 +03:00
int ctdb_log_event_script_output ( struct ctdb_context * ctdb , char * str , uint16_t len ) ;
2009-05-14 04:33:25 +04:00
int ctdb_ctrl_report_recd_lock_latency ( struct ctdb_context * ctdb , struct timeval timeout , double latency ) ;
2009-03-23 11:07:45 +03:00
2009-07-17 06:26:16 +04:00
int32_t ctdb_control_stop_node ( struct ctdb_context * ctdb , struct ctdb_req_control * c , bool * async_reply ) ;
2009-07-09 06:22:46 +04:00
int32_t ctdb_control_continue_node ( struct ctdb_context * ctdb ) ;
2009-07-29 07:25:43 +04:00
int ctdb_vacuum_init ( struct ctdb_db_context * ctdb_db ) ;
2009-08-13 07:04:08 +04:00
int32_t ctdb_control_enable_script ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_disable_script ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2009-09-03 20:20:39 +04:00
int32_t ctdb_control_set_ban_state ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_get_ban_state ( struct ctdb_context * ctdb , TDB_DATA * outdata ) ;
2009-10-10 07:26:09 +04:00
int32_t ctdb_control_set_db_priority ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2009-12-07 15:48:40 +03:00
void ctdb_ban_self ( struct ctdb_context * ctdb ) ;
2009-09-03 20:20:39 +04:00
2009-10-23 08:24:51 +04:00
int32_t ctdb_control_register_notify ( struct ctdb_context * ctdb , uint32_t client_id , TDB_DATA indata ) ;
int32_t ctdb_control_deregister_notify ( struct ctdb_context * ctdb , uint32_t client_id , TDB_DATA indata ) ;
2009-10-30 10:53:17 +03:00
int start_syslog_daemon ( struct ctdb_context * ctdb ) ;
2009-11-18 04:44:18 +03:00
/* Where to send the log messages back to */
struct ctdb_get_log_addr {
uint32_t pnn ;
uint64_t srvid ;
int32_t level ;
} ;
2010-01-15 07:38:56 +03:00
extern int log_ringbuf_size ;
2009-11-18 04:44:18 +03:00
int32_t ctdb_control_get_log ( struct ctdb_context * ctdb , TDB_DATA addr ) ;
int32_t ctdb_control_clear_log ( struct ctdb_context * ctdb ) ;
2010-01-15 07:38:56 +03:00
2009-12-08 05:14:30 +03:00
struct ctdb_log_state * ctdb_fork_with_logging ( TALLOC_CTX * mem_ctx ,
struct ctdb_context * ctdb ,
void ( * logfn ) ( const char * , uint16_t , void * ) ,
void * logfn_private , pid_t * pid ) ;
2009-11-18 04:44:18 +03:00
2009-12-02 05:58:27 +03:00
int32_t ctdb_control_process_exists ( struct ctdb_context * ctdb , pid_t pid ) ;
struct ctdb_client * ctdb_find_client_by_pid ( struct ctdb_context * ctdb , pid_t pid ) ;
2009-12-11 17:31:02 +03:00
int32_t ctdb_control_get_db_seqnum ( struct ctdb_context * ctdb ,
TDB_DATA indata ,
TDB_DATA * outdata ) ;
2009-12-07 15:28:11 +03:00
int ctdb_load_persistent_health ( struct ctdb_context * ctdb ,
struct ctdb_db_context * ctdb_db ) ;
int ctdb_update_persistent_health ( struct ctdb_context * ctdb ,
struct ctdb_db_context * ctdb_db ,
const char * reason , /* NULL means healthy */
int num_healthy_nodes ) ;
int ctdb_recheck_persistent_health ( struct ctdb_context * ctdb ) ;
2010-01-19 12:07:14 +03:00
void ctdb_run_notification_script ( struct ctdb_context * ctdb , const char * event ) ;
2009-12-18 14:32:38 +03:00
void ctdb_fault_setup ( void ) ;
2007-01-23 03:38:45 +03:00
# endif