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
2010-05-20 09:48:30 +04:00
# include "ctdb_client.h"
2007-05-25 07:05:25 +04:00
# include <sys/socket.h>
2006-11-18 02:41:20 +03:00
2017-06-07 09:44:24 +03:00
# include "common/db_hash.h"
2007-07-20 09:05:55 +04:00
/*
array of tcp connections
*/
struct ctdb_tcp_array {
uint32_t num ;
2015-10-28 10:14:21 +03:00
struct ctdb_connection * connections ;
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
*/
2020-02-26 09:03:49 +03:00
typedef int ( * ctdb_fn_t ) ( struct ctdb_call_info * ) ;
2006-11-18 02:41:20 +03:00
struct ctdb_registered_call {
struct ctdb_registered_call * next , * prev ;
uint32_t id ;
ctdb_fn_t fn ;
} ;
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-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
} ;
2006-11-18 02:41:20 +03:00
/*
state associated with one node
*/
struct ctdb_node {
struct ctdb_context * ctdb ;
2015-02-20 03:47:23 +03:00
ctdb_sock_addr address ;
2006-11-28 06:15:46 +03:00
const char * name ; /* for debug messages */
2019-11-12 04:04:22 +03:00
void * transport_data ; /* private to transport */
2007-09-04 03:50:07 +04:00
uint32_t pnn ;
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
/* 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
2019-10-26 03:41:08 +03:00
/* used by the recovery daemon to track when a node should be banned */
2009-09-03 20:20:39 +04:00
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-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
2010-09-29 04:38:41 +04:00
# define CTDB_UPDATE_STAT(ctdb, counter, value) \
{ \
if ( value > ctdb - > statistics . counter ) { \
2015-03-27 08:32:11 +03:00
ctdb - > statistics . counter = value ; \
2010-09-29 04:38:41 +04:00
} \
2010-09-29 04:58:18 +04:00
if ( value > ctdb - > statistics_current . counter ) { \
2015-03-27 08:32:11 +03:00
ctdb - > statistics_current . counter = value ; \
2010-09-29 04:58:18 +04:00
} \
2010-09-29 04:38:41 +04:00
}
# define CTDB_INCREMENT_STAT(ctdb, counter) \
{ \
ctdb - > statistics . counter + + ; \
2010-09-29 04:58:18 +04:00
ctdb - > statistics_current . counter + + ; \
2010-09-29 04:38:41 +04:00
}
# define CTDB_DECREMENT_STAT(ctdb, counter) \
{ \
if ( ctdb - > statistics . counter > 0 ) \
ctdb - > statistics . counter - - ; \
2010-09-29 04:58:18 +04:00
if ( ctdb - > statistics_current . counter > 0 ) \
ctdb - > statistics_current . counter - - ; \
2010-09-29 04:38:41 +04:00
}
2012-05-09 06:56:53 +04:00
# define CTDB_INCREMENT_DB_STAT(ctdb_db, counter) \
{ \
ctdb_db - > statistics . counter + + ; \
}
# define CTDB_DECREMENT_DB_STAT(ctdb_db, counter) \
{ \
if ( ctdb_db - > statistics . counter > 0 ) \
ctdb_db - > statistics . counter - - ; \
}
2010-09-29 04:38:41 +04:00
# define CTDB_UPDATE_RECLOCK_LATENCY(ctdb, name, counter, value) \
{ \
2012-05-09 06:56:53 +04:00
if ( value > ctdb - > statistics . counter . max ) \
2010-10-11 08:11:18 +04:00
ctdb - > statistics . counter . max = value ; \
2012-05-09 06:56:53 +04:00
if ( value > ctdb - > statistics_current . counter . max ) \
2010-10-11 08:11:18 +04:00
ctdb - > statistics_current . counter . max = value ; \
\
2012-05-09 06:56:53 +04:00
if ( ctdb - > statistics . counter . num = = 0 | | \
value < ctdb - > statistics . counter . min ) \
2010-10-11 08:11:18 +04:00
ctdb - > statistics . counter . min = value ; \
2012-05-09 06:56:53 +04:00
if ( ctdb - > statistics_current . counter . num = = 0 | | \
value < ctdb - > statistics_current . counter . min ) \
2010-10-11 08:11:18 +04:00
ctdb - > statistics_current . counter . min = value ; \
\
2012-05-09 06:56:53 +04:00
ctdb - > statistics . counter . total + = value ; \
ctdb - > statistics_current . counter . total + = value ; \
2010-10-11 08:11:18 +04:00
\
ctdb - > statistics . counter . num + + ; \
ctdb - > statistics_current . counter . num + + ; \
2010-09-29 04:38:41 +04:00
\
if ( ctdb - > tunable . reclock_latency_ms ! = 0 ) { \
if ( value * 1000 > ctdb - > tunable . reclock_latency_ms ) { \
2012-05-09 06:56:53 +04:00
DEBUG ( DEBUG_ERR , \
( " High RECLOCK latency %fs for operation %s \n " , \
value , name ) ) ; \
2010-09-29 04:38:41 +04:00
} \
} \
}
2012-11-14 08:51:59 +04:00
# define CTDB_UPDATE_DB_LATENCY(ctdb_db, operation, counter, value) \
2012-05-09 06:56:53 +04:00
{ \
if ( value > ctdb_db - > statistics . counter . max ) \
ctdb_db - > statistics . counter . max = value ; \
if ( ctdb_db - > statistics . counter . num = = 0 | | \
value < ctdb_db - > statistics . counter . min ) \
ctdb_db - > statistics . counter . min = value ; \
\
ctdb_db - > statistics . counter . total + = value ; \
ctdb_db - > statistics . counter . num + + ; \
\
2012-11-30 05:21:30 +04:00
if ( ctdb_db - > ctdb - > tunable . log_latency_ms ! = 0 ) { \
2012-11-14 08:51:59 +04:00
if ( value * 1000 > ctdb_db - > ctdb - > tunable . log_latency_ms ) { \
2012-05-09 06:56:53 +04:00
DEBUG ( DEBUG_ERR , \
2012-11-14 08:51:59 +04:00
( " High latency %.6fs for operation %s on database %s \n " , \
value , operation , ctdb_db - > db_name ) ) ; \
2012-05-09 06:56:53 +04:00
} \
} \
}
2010-09-29 04:38:41 +04:00
# define CTDB_UPDATE_LATENCY(ctdb, db, operation, counter, t) \
{ \
double l = timeval_elapsed ( & t ) ; \
2010-10-11 08:11:18 +04:00
\
if ( l > ctdb - > statistics . counter . max ) \
ctdb - > statistics . counter . max = l ; \
if ( l > ctdb - > statistics_current . counter . max ) \
ctdb - > statistics_current . counter . max = l ; \
\
2012-05-09 06:56:53 +04:00
if ( ctdb - > statistics . counter . num = = 0 | | \
l < ctdb - > statistics . counter . min ) \
2010-10-11 08:11:18 +04:00
ctdb - > statistics . counter . min = l ; \
2012-05-09 06:56:53 +04:00
if ( ctdb - > statistics_current . counter . num = = 0 | | \
l < ctdb - > statistics_current . counter . min ) \
2010-10-11 08:11:18 +04:00
ctdb - > statistics_current . counter . min = l ; \
\
ctdb - > statistics . counter . total + = l ; \
ctdb - > statistics_current . counter . total + = l ; \
\
ctdb - > statistics . counter . num + + ; \
ctdb - > statistics_current . counter . num + + ; \
2010-09-29 04:38:41 +04:00
\
2012-05-09 06:56:53 +04:00
if ( ctdb - > tunable . log_latency_ms ! = 0 ) { \
2010-09-29 04:38:41 +04:00
if ( l * 1000 > ctdb - > tunable . log_latency_ms ) { \
2012-05-09 06:56:53 +04:00
DEBUG ( DEBUG_WARNING , \
( " High latency %.6fs for operation %s on database %s \n " , \
l , operation , db - > db_name ) ) ; \
2010-09-29 04:38:41 +04:00
} \
} \
}
2016-01-19 12:33:58 +03:00
struct ctdb_cluster_mutex_handle ;
2016-08-27 10:26:28 +03:00
struct eventd_context ;
2016-01-19 12:33:58 +03: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
2006-11-18 02:41:20 +03:00
/* main state of the ctdb daemon */
struct ctdb_context {
2010-08-18 03:46:31 +04:00
struct tevent_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 ;
2011-09-06 11:02:19 +04:00
TALLOC_CTX * check_public_ifaces_ctx ;
2015-10-28 10:51:22 +03:00
struct ctdb_tunable_list tunable ;
2016-07-19 09:32:16 +03:00
enum ctdb_freeze_mode freeze_mode ;
struct ctdb_freeze_handle * freeze_handle ;
2009-10-12 05:08:39 +04:00
bool freeze_transaction_started ;
uint32_t freeze_transaction_id ;
2015-02-20 03:47:23 +03:00
ctdb_sock_addr * 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 ;
2016-05-17 11:28:56 +03:00
const char * recovery_lock ;
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 ;
2015-03-17 06:30:18 +03:00
struct reqid_context * idr ;
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 */
2015-10-28 09:34:24 +03:00
struct ctdb_interface * 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 */
2019-11-12 04:12:46 +03:00
void * transport_data ; /* private to transport */
2007-04-03 13:41:00 +04:00
struct ctdb_db_context * db_list ;
2015-04-08 07:38:26 +03:00
struct srvid_context * srv ;
2017-04-06 12:03:51 +03:00
struct srvid_context * tunnels ;
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 ;
2010-09-29 04:58:18 +04:00
struct ctdb_statistics statistics_current ;
2010-09-29 06:13:05 +04:00
# define MAX_STAT_HISTORY 100
struct ctdb_statistics statistics_history [ MAX_STAT_HISTORY ] ;
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-06-18 21:54:06 +04:00
struct ctdb_client_ip * client_ip_list ;
2012-03-22 08:27:25 +04:00
bool do_checkpublicip ;
2011-01-10 05:35:39 +03:00
bool do_setsched ;
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 ;
2008-01-07 08:17:22 +03:00
pid_t ctdbd_pid ;
2007-10-22 06:34:08 +04:00
pid_t recoverd_pid ;
2013-01-10 09:06:25 +04:00
enum ctdb_runstate runstate ;
2008-01-10 06:40:56 +03:00
struct ctdb_monitor_state * monitor ;
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-09-17 08:17:41 +04:00
uint32_t * recd_ping_count ;
2012-12-04 08:05:44 +04:00
TALLOC_CTX * recd_ctx ; /* a context used to track recoverd monitoring events */
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
2016-08-27 10:26:28 +03:00
struct eventd_context * ectx ;
2009-09-03 20:20:39 +04:00
TALLOC_CTX * banning_ctx ;
2009-12-02 05:41:04 +03:00
2019-10-04 05:06:21 +03:00
struct ctdb_vacuum_child_context * vacuumer ;
2010-07-21 06:59:55 +04:00
2009-12-02 05:41:04 +03:00
/* mapping from pid to ctdb_client * */
struct ctdb_client_pid_list * client_pids ;
2010-04-08 08:07:57 +04:00
2011-02-23 07:46:36 +03:00
/* Used to defer db attach requests while in recovery mode */
struct ctdb_deferred_attach_context * deferred_attach ;
2012-02-21 00:03:44 +04:00
/* if we are a child process, do we have a domain socket to send controls on */
bool can_send_controls ;
2012-02-22 10:38:12 +04:00
2012-04-30 09:50:44 +04:00
struct ctdb_reloadips_handle * reload_ips ;
2013-10-21 12:33:10 +04:00
const char * nodes_file ;
2012-04-30 09:50:44 +04:00
const char * public_addresses_file ;
2012-05-03 05:42:41 +04:00
struct trbt_tree * child_processes ;
2012-10-11 04:29:29 +04:00
/* Used for locking record/db/alldb */
struct lock_context * lock_current ;
struct lock_context * lock_pending ;
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 ;
2017-03-02 07:53:17 +03:00
uint8_t db_flags ;
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 ;
2011-07-20 07:15:48 +04:00
struct tdb_context * rottdb ; /* ReadOnly tracking TDB */
2007-04-03 13:41:00 +04:00
struct ctdb_registered_call * calls ; /* list of registered calls */
2007-05-04 16:18:00 +04:00
uint32_t seqnum ;
2015-10-26 08:50:09 +03:00
struct tevent_timer * seqnum_update ;
2009-05-06 01:32:25 +04:00
struct ctdb_traverse_local_handle * traverse ;
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 ;
2011-01-21 13:47:02 +03:00
int pending_requests ;
2011-07-20 07:49:17 +04:00
struct revokechild_handle * revokechild_active ;
2011-02-23 02:00:04 +03:00
struct ctdb_persistent_state * persistent_state ;
2010-12-22 16:50:53 +03:00
struct trbt_tree * delete_queue ;
2018-02-16 07:30:13 +03:00
struct trbt_tree * fetch_queue ;
2012-03-20 09:58:35 +04:00
struct trbt_tree * sticky_records ;
2010-12-30 20:19:32 +03:00
int ( * ctdb_ltdb_store_fn ) ( struct ctdb_db_context * ctdb_db ,
TDB_DATA key ,
struct ctdb_ltdb_header * header ,
TDB_DATA data ) ;
2011-11-07 23:55:46 +04:00
/* used to track which records we are currently fetching
so we can avoid sending duplicate fetch requests
*/
struct trbt_tree * deferred_fetch ;
2014-08-15 09:20:36 +04:00
struct trbt_tree * defer_dmaster ;
2012-02-08 08:29:27 +04:00
2015-10-29 09:33:09 +03:00
struct ctdb_db_statistics_old statistics ;
2013-11-15 08:58:59 +04:00
2014-07-24 09:56:41 +04:00
struct lock_context * lock_current ;
struct lock_context * lock_pending ;
2020-02-10 09:50:30 +03:00
unsigned int lock_num_current ;
2017-06-07 09:44:24 +03:00
struct db_hash_context * lock_log ;
2014-08-05 08:42:00 +04:00
struct ctdb_call_state * pending_calls ;
2014-08-05 08:16:29 +04:00
enum ctdb_freeze_mode freeze_mode ;
struct ctdb_db_freeze_handle * freeze_handle ;
bool freeze_transaction_started ;
uint32_t freeze_transaction_id ;
2015-09-11 07:20:44 +03:00
uint32_t generation ;
2016-02-19 09:32:09 +03:00
2018-02-14 06:29:18 +03:00
bool invalid_records ;
2016-02-19 09:32:09 +03:00
bool push_started ;
void * push_state ;
2017-03-21 08:48:45 +03:00
struct hash_count_context * migratedb ;
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 )
2007-06-07 10:34:33 +04:00
2007-04-09 05:51:27 +04:00
enum call_state { CTDB_CALL_WAIT , CTDB_CALL_DONE , CTDB_CALL_ERROR } ;
/*
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 ;
2015-10-29 08:26:29 +03:00
struct ctdb_req_call_old * c ;
2007-04-09 05:51:27 +04:00
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-27 13:38:13 +03:00
/* internal prototypes */
2014-08-15 07:22:29 +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 )
2011-03-09 02:56:25 +03:00
# define CHECK_CONTROL_MIN_DATA_SIZE(size) do { \
if ( indata . dsize < size ) { \
DEBUG ( 0 , ( __location__ " Invalid data size in opcode %u. Got %u expected >= %u \n " , \
opcode , ( unsigned ) indata . dsize , ( unsigned ) size ) ) ; \
return - 1 ; \
} \
} while ( 0 )
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 ;
} ;
2008-10-17 00:56:12 +04:00
extern int script_log_level ;
2010-06-22 17:22:34 +04:00
extern bool fast_start ;
2013-04-15 07:32:57 +04:00
extern const char * ctdbd_pidfile ;
2008-10-17 00:56:12 +04:00
2011-07-20 07:49:17 +04:00
typedef void ( * deferred_requeue_fn ) ( void * call_context , struct ctdb_req_header * hdr ) ;
2012-04-30 09:50:44 +04:00
2015-10-23 06:47:09 +03:00
/* from tcp/ and ib/ */
int ctdb_tcp_init ( struct ctdb_context * ctdb ) ;
int ctdb_ibw_init ( struct ctdb_context * ctdb ) ;
2015-10-23 06:48:44 +03:00
/* from ctdb_banning.c */
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 ) ;
void ctdb_ban_self ( struct ctdb_context * ctdb ) ;
2015-10-23 06:56:00 +03:00
/* from ctdb_call.c */
struct ctdb_db_context * find_ctdb_db ( struct ctdb_context * ctdb , uint32_t id ) ;
void ctdb_request_dmaster ( struct ctdb_context * ctdb ,
struct ctdb_req_header * hdr ) ;
void ctdb_reply_dmaster ( struct ctdb_context * ctdb ,
struct ctdb_req_header * hdr ) ;
void ctdb_request_call ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
void ctdb_reply_call ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
void ctdb_reply_error ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
void ctdb_call_resend_db ( struct ctdb_db_context * ctdb ) ;
void ctdb_call_resend_all ( struct ctdb_context * ctdb ) ;
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 ) ;
struct ctdb_call_state * ctdb_daemon_call_send_remote (
struct ctdb_db_context * ctdb_db ,
struct ctdb_call * call ,
struct ctdb_ltdb_header * header ) ;
int ctdb_daemon_call_recv ( struct ctdb_call_state * state ,
struct ctdb_call * call ) ;
int ctdb_start_revoke_ro_record ( struct ctdb_context * ctdb ,
struct ctdb_db_context * ctdb_db ,
TDB_DATA key , struct ctdb_ltdb_header * header ,
TDB_DATA data ) ;
int ctdb_add_revoke_deferred_call ( struct ctdb_context * ctdb ,
struct ctdb_db_context * ctdb_db ,
TDB_DATA key , struct ctdb_req_header * hdr ,
deferred_requeue_fn fn , void * call_context ) ;
2017-03-21 08:48:45 +03:00
int ctdb_migration_init ( struct ctdb_db_context * ctdb_db ) ;
2015-10-23 06:58:14 +03:00
/* from server/ctdb_control.c */
int32_t ctdb_dump_memory ( struct ctdb_context * ctdb , TDB_DATA * outdata ) ;
void ctdb_request_control_reply ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 06:58:14 +03:00
TDB_DATA * outdata , int32_t status ,
const char * errormsg ) ;
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 ,
uint64_t srvid , uint32_t opcode ,
uint32_t client_id , uint32_t flags ,
TDB_DATA data ,
ctdb_control_callback_fn_t callback ,
void * private_data ) ;
2015-10-23 07:04:17 +03:00
/* from server/ctdb_daemon.c */
int daemon_register_message_handler ( struct ctdb_context * ctdb ,
uint32_t client_id , uint64_t srvid ) ;
int daemon_deregister_message_handler ( struct ctdb_context * ctdb ,
uint32_t client_id , uint64_t srvid ) ;
2017-04-06 12:03:51 +03:00
void daemon_tunnel_handler ( uint64_t tunnel_id , TDB_DATA data ,
void * private_data ) ;
2020-01-29 08:08:56 +03:00
int ctdb_start_daemon ( struct ctdb_context * ctdb ,
bool interactive ,
bool test_mode_enabled ) ;
2015-10-23 07:04:17 +03:00
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 )
void ctdb_daemon_cancel_controls ( struct ctdb_context * ctdb ,
struct ctdb_node * node ) ;
int ctdb_daemon_set_call ( struct ctdb_context * ctdb , uint32_t db_id ,
ctdb_fn_t fn , int id ) ;
int ctdb_daemon_send_message ( struct ctdb_context * ctdb , uint32_t pnn ,
uint64_t srvid , TDB_DATA data ) ;
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 ) ;
struct ctdb_client * ctdb_find_client_by_pid ( struct ctdb_context * ctdb ,
pid_t pid ) ;
int32_t ctdb_control_process_exists ( struct ctdb_context * ctdb , pid_t pid ) ;
2017-08-30 09:18:02 +03:00
int32_t ctdb_control_check_pid_srvid ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
2015-10-23 07:04:17 +03:00
int ctdb_control_getnodesfile ( struct ctdb_context * ctdb , uint32_t opcode ,
TDB_DATA indata , TDB_DATA * outdata ) ;
void ctdb_shutdown_sequence ( struct ctdb_context * ctdb , int exit_code ) ;
2016-11-25 06:44:10 +03:00
int switch_from_server_to_client ( struct ctdb_context * ctdb ) ;
2015-11-11 06:18:51 +03:00
2015-11-11 06:26:53 +03:00
/* From server/ctdb_fork.c */
void ctdb_track_child ( struct ctdb_context * ctdb , pid_t pid ) ;
pid_t ctdb_fork ( struct ctdb_context * ctdb ) ;
2016-11-30 04:15:11 +03:00
pid_t ctdb_vfork_exec ( TALLOC_CTX * mem_ctx , struct ctdb_context * ctdb ,
const char * helper , int helper_argc ,
const char * * helper_argv ) ;
2015-11-11 06:26:53 +03:00
struct tevent_signal * ctdb_init_sigchld ( struct ctdb_context * ctdb ) ;
int ctdb_kill ( struct ctdb_context * ctdb , pid_t pid , int signum ) ;
2015-10-23 07:08:05 +03:00
/* from server/ctdb_freeze.c */
int32_t ctdb_control_db_freeze ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:08:05 +03:00
uint32_t db_id , bool * async_reply ) ;
int32_t ctdb_control_db_thaw ( struct ctdb_context * ctdb , uint32_t db_id ) ;
int32_t ctdb_control_freeze ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c , bool * async_reply ) ;
2016-07-19 09:32:16 +03:00
int32_t ctdb_control_thaw ( struct ctdb_context * ctdb , bool check_recmode ) ;
2015-10-23 07:08:05 +03:00
bool ctdb_blocking_freeze ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_db_transaction_start ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
int32_t ctdb_control_db_transaction_cancel ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
int32_t ctdb_control_db_transaction_commit ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
int32_t ctdb_control_wipe_database ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
bool ctdb_db_frozen ( struct ctdb_db_context * ctdb_db ) ;
bool ctdb_db_all_frozen ( struct ctdb_context * ctdb ) ;
2017-09-07 10:18:18 +03:00
bool ctdb_db_allow_access ( struct ctdb_db_context * ctdb_db ) ;
2015-10-23 07:08:05 +03:00
2015-10-23 07:08:51 +03:00
/* from server/ctdb_keepalive.c */
void ctdb_start_keepalive ( struct ctdb_context * ctdb ) ;
void ctdb_stop_keepalive ( struct ctdb_context * ctdb ) ;
2017-04-21 10:55:11 +03:00
void ctdb_request_keepalive ( struct ctdb_context * ctdb ,
struct ctdb_req_header * hdr ) ;
2012-10-11 04:29:29 +04:00
/* from server/ctdb_lock.c */
2015-10-23 07:10:48 +03:00
2012-10-11 04:29:29 +04:00
struct lock_request ;
2014-08-05 10:45:34 +04:00
typedef int ( * ctdb_db_handler_t ) ( struct ctdb_db_context * ctdb_db ,
void * private_data ) ;
2014-08-05 10:49:06 +04:00
int ctdb_db_iterator ( struct ctdb_context * ctdb , ctdb_db_handler_t handler ,
void * private_data ) ;
2014-08-05 10:45:34 +04:00
2015-10-23 07:10:48 +03:00
int ctdb_lockdb_mark ( struct ctdb_db_context * ctdb_db ) ;
2012-10-11 04:29:29 +04:00
2015-09-10 06:24:43 +03:00
int ctdb_lockdb_unmark ( struct ctdb_db_context * ctdb_db ) ;
2014-08-11 11:08:20 +04:00
struct lock_request * ctdb_lock_record ( TALLOC_CTX * mem_ctx ,
struct ctdb_db_context * ctdb_db ,
2012-10-11 04:29:29 +04:00
TDB_DATA key ,
bool auto_mark ,
void ( * callback ) ( void * , bool ) ,
void * private_data ) ;
2014-08-11 11:08:20 +04:00
struct lock_request * ctdb_lock_db ( TALLOC_CTX * mem_ctx ,
struct ctdb_db_context * ctdb_db ,
2012-10-11 04:29:29 +04:00
bool auto_mark ,
void ( * callback ) ( void * , bool ) ,
void * private_data ) ;
2015-10-23 07:13:54 +03:00
/* from ctdb_logging.c */
2016-11-30 08:46:19 +03:00
bool ctdb_logging_init ( TALLOC_CTX * mem_ctx , const char * logging ,
const char * debug_level ) ;
2015-10-23 07:13:54 +03:00
int ctdb_set_child_logging ( struct ctdb_context * ctdb ) ;
2015-10-23 07:14:53 +03:00
/* from ctdb_logging_file.c */
void ctdb_log_init_file ( void ) ;
2015-10-23 07:15:28 +03:00
/* from ctdb_logging_syslog.c */
void ctdb_log_init_syslog ( void ) ;
2015-10-23 07:21:13 +03:00
/* from ctdb_ltdb_server.c */
int ctdb_ltdb_lock_requeue ( struct ctdb_db_context * ctdb_db ,
TDB_DATA key , struct ctdb_req_header * hdr ,
void ( * recv_pkt ) ( void * , struct ctdb_req_header * ) ,
void * recv_context , bool ignore_generation ) ;
int ctdb_ltdb_lock_fetch_requeue ( struct ctdb_db_context * ctdb_db ,
TDB_DATA key , struct ctdb_ltdb_header * header ,
struct ctdb_req_header * hdr , TDB_DATA * data ,
void ( * recv_pkt ) ( void * , struct ctdb_req_header * ) ,
void * recv_context , bool ignore_generation ) ;
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 */
2019-06-07 23:38:56 +03:00
unsigned int num_healthy_nodes ) ;
2015-10-23 07:21:13 +03:00
int ctdb_recheck_persistent_health ( struct ctdb_context * ctdb ) ;
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 ) ;
int ctdb_set_db_readonly ( struct ctdb_context * ctdb ,
struct ctdb_db_context * ctdb_db ) ;
int ctdb_process_deferred_attach ( struct ctdb_context * ctdb ) ;
2018-06-26 13:12:23 +03:00
int32_t ctdb_control_db_attach ( struct ctdb_context * ctdb ,
TDB_DATA indata ,
2017-03-28 09:14:51 +03:00
TDB_DATA * outdata ,
2018-06-26 13:12:23 +03:00
uint8_t db_flags ,
uint32_t srcnode ,
uint32_t client_id ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:21:13 +03:00
bool * async_reply ) ;
int32_t ctdb_control_db_detach ( struct ctdb_context * ctdb , TDB_DATA indata ,
uint32_t client_id ) ;
int ctdb_attach_databases ( struct ctdb_context * ctdb ) ;
int32_t ctdb_ltdb_update_seqnum ( struct ctdb_context * ctdb , uint32_t db_id ,
uint32_t srcnode ) ;
int32_t ctdb_ltdb_enable_seqnum ( struct ctdb_context * ctdb , uint32_t db_id ) ;
int ctdb_set_db_sticky ( struct ctdb_context * ctdb ,
struct ctdb_db_context * ctdb_db ) ;
void ctdb_db_statistics_reset ( struct ctdb_db_context * ctdb_db ) ;
int32_t ctdb_control_get_db_statistics ( struct ctdb_context * ctdb ,
uint32_t db_id , TDB_DATA * outdata ) ;
2015-10-23 07:23:18 +03:00
/* from ctdb_monitor.c */
void ctdb_run_notification_script ( struct ctdb_context * ctdb , const char * event ) ;
2017-09-18 09:36:08 +03:00
void ctdb_stop_monitoring ( struct ctdb_context * ctdb ) ;
2015-10-23 07:23:18 +03:00
void ctdb_wait_for_first_recovery ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_modflags ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2015-10-23 07:25:24 +03:00
/* from ctdb_persistent.c */
void ctdb_persistent_finish_trans3_commits ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_trans3_commit ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:25:24 +03:00
TDB_DATA recdata , bool * async_reply ) ;
int32_t ctdb_control_start_persistent_update ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:25:24 +03:00
TDB_DATA recdata ) ;
int32_t ctdb_control_cancel_persistent_update ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:25:24 +03:00
TDB_DATA recdata ) ;
int32_t ctdb_control_get_db_seqnum ( struct ctdb_context * ctdb ,
TDB_DATA indata , TDB_DATA * outdata ) ;
2015-10-23 07:54:59 +03:00
/* from ctdb_recover.c */
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 ) ;
int ctdb_control_getdbmap ( struct ctdb_context * ctdb , uint32_t opcode ,
TDB_DATA indata , TDB_DATA * outdata ) ;
int ctdb_control_getnodemap ( struct ctdb_context * ctdb , uint32_t opcode ,
TDB_DATA indata , TDB_DATA * outdata ) ;
int ctdb_control_reload_nodes_file ( struct ctdb_context * ctdb , uint32_t opcode ) ;
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 ) ;
2016-02-19 09:32:09 +03:00
int32_t ctdb_control_db_pull ( struct ctdb_context * ctdb ,
struct ctdb_req_control_old * c ,
TDB_DATA indata , TDB_DATA * outdata ) ;
int32_t ctdb_control_db_push_start ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
int32_t ctdb_control_db_push_confirm ( struct ctdb_context * ctdb ,
TDB_DATA indata , TDB_DATA * outdata ) ;
2015-10-23 07:54:59 +03:00
int ctdb_deferred_drop_all_ips ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_set_recmode ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:54:59 +03:00
TDB_DATA indata , bool * async_reply ,
const char * * errormsg ) ;
int32_t ctdb_control_end_recovery ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:54:59 +03:00
bool * async_reply ) ;
int32_t ctdb_control_start_recovery ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:54:59 +03:00
bool * async_reply ) ;
int32_t ctdb_control_try_delete_records ( struct ctdb_context * ctdb ,
TDB_DATA indata , TDB_DATA * outdata ) ;
int32_t ctdb_control_get_capabilities ( struct ctdb_context * ctdb ,
TDB_DATA * outdata ) ;
int32_t ctdb_control_recd_ping ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_set_recmaster ( struct ctdb_context * ctdb ,
uint32_t opcode , TDB_DATA indata ) ;
2019-08-19 14:47:03 +03:00
void ctdb_node_become_inactive ( struct ctdb_context * ctdb ) ;
2015-10-23 07:54:59 +03:00
int32_t ctdb_control_stop_node ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_continue_node ( struct ctdb_context * ctdb ) ;
2015-10-23 07:57:25 +03:00
/* from ctdb_recoverd.c */
int ctdb_start_recoverd ( struct ctdb_context * ctdb ) ;
void ctdb_stop_recoverd ( struct ctdb_context * ctdb ) ;
2015-10-23 07:28:56 +03:00
/* from ctdb_server.c */
int ctdb_set_transport ( struct ctdb_context * ctdb , const char * transport ) ;
2019-08-08 09:20:44 +03:00
struct ctdb_node * ctdb_ip_to_node ( struct ctdb_context * ctdb ,
const ctdb_sock_addr * nodeip ) ;
2019-06-21 22:53:15 +03:00
uint32_t ctdb_ip_to_pnn ( struct ctdb_context * ctdb ,
const ctdb_sock_addr * nodeip ) ;
2015-10-23 07:28:56 +03:00
void ctdb_load_nodes_file ( struct ctdb_context * ctdb ) ;
int ctdb_set_address ( struct ctdb_context * ctdb , const char * address ) ;
uint32_t ctdb_get_num_active_nodes ( struct ctdb_context * ctdb ) ;
void ctdb_input_pkt ( struct ctdb_context * ctdb , struct ctdb_req_header * ) ;
void ctdb_node_dead ( struct ctdb_node * node ) ;
void ctdb_node_connected ( struct ctdb_node * node ) ;
void ctdb_queue_packet ( struct ctdb_context * ctdb , struct ctdb_req_header * hdr ) ;
void ctdb_queue_packet_opcode ( struct ctdb_context * ctdb ,
struct ctdb_req_header * hdr , unsigned opcode ) ;
2015-10-23 07:30:37 +03:00
/* from ctdb_serverids.c */
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 ) ;
int32_t ctdb_control_get_server_id_list ( struct ctdb_context * ctdb ,
TDB_DATA * outdata ) ;
2015-10-23 07:31:34 +03:00
/* from ctdb_statistics.c */
int ctdb_statistics_init ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_get_stat_history ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:31:34 +03:00
TDB_DATA * outdata ) ;
2015-10-23 07:40:19 +03:00
/* from ctdb_takeover.c */
int32_t ctdb_control_takeover_ip ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
TDB_DATA indata ,
bool * async_reply ) ;
int32_t ctdb_control_release_ip ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
TDB_DATA indata ,
bool * async_reply ) ;
int32_t ctdb_control_ipreallocated ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
bool * async_reply ) ;
int ctdb_set_public_addresses ( struct ctdb_context * ctdb , bool check_addresses ) ;
int32_t ctdb_control_tcp_client ( struct ctdb_context * ctdb , uint32_t client_id ,
TDB_DATA indata ) ;
int32_t ctdb_control_tcp_add ( struct ctdb_context * ctdb , TDB_DATA indata ,
bool tcp_update_needed ) ;
int32_t ctdb_control_tcp_remove ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
int32_t ctdb_control_startup ( struct ctdb_context * ctdb , uint32_t vnn ) ;
void ctdb_takeover_client_destructor_hook ( struct ctdb_client * client ) ;
void ctdb_release_all_ips ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_get_public_ips ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
TDB_DATA * outdata ) ;
int32_t ctdb_control_get_public_ip_info ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
TDB_DATA indata , TDB_DATA * outdata ) ;
int32_t ctdb_control_get_ifaces ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
TDB_DATA * outdata ) ;
int32_t ctdb_control_set_iface_link ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
TDB_DATA indata ) ;
int32_t ctdb_control_set_tcp_tickle_list ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
int32_t ctdb_control_get_tcp_tickle_list ( struct ctdb_context * ctdb ,
TDB_DATA indata , TDB_DATA * outdata ) ;
void ctdb_start_tcp_tickle_update ( struct ctdb_context * ctdb ) ;
int32_t ctdb_control_send_gratious_arp ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
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 ,
2014-01-22 10:12:09 +04:00
TDB_DATA recdata ) ;
2015-10-23 07:40:19 +03:00
int32_t ctdb_control_reload_public_ips ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:40:19 +03:00
bool * async_reply ) ;
2015-10-23 07:42:50 +03:00
/* from ctdb_traverse.c */
int32_t ctdb_control_traverse_all_ext ( struct ctdb_context * ctdb ,
TDB_DATA data , TDB_DATA * outdata ) ;
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 ) ;
int32_t ctdb_control_traverse_kill ( struct ctdb_context * ctdb , TDB_DATA indata ,
TDB_DATA * outdata , uint32_t srcnode ) ;
int32_t ctdb_control_traverse_start_ext ( struct ctdb_context * ctdb ,
TDB_DATA indata , TDB_DATA * outdata ,
uint32_t srcnode , uint32_t client_id ) ;
int32_t ctdb_control_traverse_start ( struct ctdb_context * ctdb ,
TDB_DATA indata , TDB_DATA * outdata ,
uint32_t srcnode , uint32_t client_id ) ;
2015-10-23 07:44:21 +03:00
/* from ctdb_tunables.c */
void ctdb_tunables_set_defaults ( struct ctdb_context * ctdb ) ;
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 ) ;
2017-04-06 12:03:51 +03:00
/* from ctdb_tunnel.c */
int32_t ctdb_control_tunnel_register ( struct ctdb_context * ctdb ,
uint32_t client_id , uint64_t tunnel_id ) ;
int32_t ctdb_control_tunnel_deregister ( struct ctdb_context * ctdb ,
uint32_t client_id , uint64_t tunnel_id ) ;
2017-04-06 12:09:58 +03:00
int ctdb_daemon_send_tunnel ( struct ctdb_context * ctdb , uint32_t destnode ,
uint64_t tunnel_id , uint32_t client_id ,
TDB_DATA data ) ;
void ctdb_request_tunnel ( struct ctdb_context * ctdb ,
struct ctdb_req_header * hdr ) ;
2015-10-23 07:45:55 +03:00
/* from ctdb_update_record.c */
int32_t ctdb_control_update_record ( struct ctdb_context * ctdb ,
2015-10-29 08:42:05 +03:00
struct ctdb_req_control_old * c ,
2015-10-23 07:45:55 +03:00
TDB_DATA recdata , bool * async_reply ) ;
2015-10-23 07:46:49 +03:00
/* from ctdb_uptime.c */
int32_t ctdb_control_uptime ( struct ctdb_context * ctdb , TDB_DATA * outdata ) ;
2015-10-23 07:49:32 +03:00
/* from ctdb_vacuum.c */
2019-07-30 07:17:11 +03:00
int32_t ctdb_control_db_vacuum ( struct ctdb_context * ctdb ,
struct ctdb_req_control_old * c ,
TDB_DATA indata ,
bool * async_reply ) ;
2015-10-23 07:49:32 +03:00
void ctdb_stop_vacuuming ( struct ctdb_context * ctdb ) ;
int ctdb_vacuum_init ( struct ctdb_db_context * ctdb_db ) ;
int32_t ctdb_control_schedule_for_deletion ( struct ctdb_context * ctdb ,
TDB_DATA indata ) ;
int32_t ctdb_local_schedule_for_deletion ( struct ctdb_db_context * ctdb_db ,
const struct ctdb_ltdb_header * hdr ,
TDB_DATA key ) ;
void ctdb_local_remove_from_delete_queue ( struct ctdb_db_context * ctdb_db ,
const struct ctdb_ltdb_header * hdr ,
const TDB_DATA key ) ;
2018-02-16 07:30:13 +03:00
int32_t ctdb_control_vacuum_fetch ( struct ctdb_context * ctdb , TDB_DATA indata ) ;
2015-10-23 08:00:39 +03:00
/* from eventscript.c */
2016-08-27 10:26:28 +03:00
int ctdb_start_eventd ( struct ctdb_context * ctdb ) ;
void ctdb_stop_eventd ( struct ctdb_context * ctdb ) ;
2015-10-23 08:00:39 +03:00
int ctdb_event_script_callback ( struct ctdb_context * ctdb ,
TALLOC_CTX * mem_ctx ,
void ( * callback ) ( struct ctdb_context * ,
int , void * ) ,
void * private_data ,
2015-10-28 08:54:10 +03:00
enum ctdb_event call ,
2015-10-23 08:00:39 +03:00
const char * fmt , . . . ) PRINTF_ATTRIBUTE ( 6 , 7 ) ;
int ctdb_event_script_args ( struct ctdb_context * ctdb ,
2015-10-28 08:54:10 +03:00
enum ctdb_event call ,
2015-10-23 08:00:39 +03:00
const char * fmt , . . . ) PRINTF_ATTRIBUTE ( 3 , 4 ) ;
int ctdb_event_script ( struct ctdb_context * ctdb ,
2015-10-28 08:54:10 +03:00
enum ctdb_event call ) ;
2015-10-23 08:00:39 +03:00
2007-01-23 03:38:45 +03:00
# endif