19 typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL, SLAVE_THD_WORKER } SLAVE_THD_TYPE;
24 #define MASTER_DELAY_MAX (0x7FFFFFFF)
25 #if INT_MAX < 0x7FFFFFFF
26 #error "don't support platforms where INT_MAX < 0x7FFFFFFF"
44 #define SLAVE_MAX_HEARTBEAT_PERIOD 4294967
46 #ifdef HAVE_REPLICATION
51 #include "rpl_filter.h"
52 #include "rpl_tblmap.h"
54 #define SLAVE_NET_TIMEOUT 3600
56 #define MAX_SLAVE_ERROR 2000
58 #define MTS_WORKER_UNDEF ((ulong) -1)
59 #define MTS_MAX_WORKERS 1024
67 #define MTS_MAX_BITS_IN_GROUP ((1L << 19) - 8)
73 extern bool server_id_supplied;
235 extern ulong master_retry_count;
237 extern char slave_skip_error_names[];
238 extern bool use_slave_mask;
239 extern char *slave_load_tmpdir;
240 extern char *master_info_file, *relay_log_info_file;
241 extern char *opt_relay_logname, *opt_relaylog_index_name;
242 extern char *opt_binlog_index_name;
243 extern my_bool opt_skip_slave_start, opt_reckless_slave;
244 extern my_bool opt_log_slave_updates;
245 extern char *opt_slave_skip_errors;
246 extern ulonglong relay_log_space_limit;
248 extern const char *relay_log_index;
249 extern const char *relay_log_basename;
262 #define MYSQL_SLAVE_NOT_RUN 0
263 #define MYSQL_SLAVE_RUN_NOT_CONNECT 1
264 #define MYSQL_SLAVE_RUN_CONNECT 2
270 #define SLAVE_FORCE_ALL 4
272 int start_slave(THD* thd, Master_info* mi,
bool net_report);
273 int stop_slave(THD* thd, Master_info* mi,
bool net_report);
274 bool change_master(THD* thd, Master_info* mi);
275 int reset_slave(THD *thd, Master_info* mi);
277 int init_recovery(Master_info* mi,
const char** errmsg);
278 int global_init_info(Master_info* mi,
bool ignore_if_no_info,
int thread_mask);
279 void end_info(Master_info* mi);
280 int remove_info(Master_info* mi);
281 int flush_master_info(Master_info* mi,
bool force);
282 void add_slave_skip_errors(
const char* arg);
283 void set_slave_skip_errors(
char** slave_skip_errors_ptr);
284 int register_slave_on_master(
MYSQL* mysql);
285 int terminate_slave_threads(Master_info* mi,
int thread_mask,
286 bool need_lock_term=
true);
287 int start_slave_threads(
bool need_lock_slave,
bool wait_for_start,
288 Master_info* mi,
int thread_mask);
295 int start_slave_thread(
296 #ifdef HAVE_PSI_INTERFACE
297 PSI_thread_key thread_key,
299 pthread_handler h_func,
303 volatile uint *slave_running,
304 volatile ulong *slave_run_id,
308 int fetch_master_table(THD* thd,
const char* db_name,
const char*
table_name,
309 Master_info* mi,
MYSQL* mysql,
bool overwrite);
311 bool show_slave_status(THD* thd, Master_info* mi);
312 bool rpl_master_has_bug(
const Relay_log_info *rli, uint bug_id,
bool report,
313 bool (*pred)(
const void *),
const void *param);
314 bool rpl_master_erroneous_autoinc(THD* thd);
316 const char *print_slave_db_safe(
const char *db);
317 void skip_load_data_infile(
NET* net);
320 void close_active_mi();
323 void lock_slave_threads(Master_info* mi);
324 void unlock_slave_threads(Master_info* mi);
325 void init_thread_mask(
int* mask,Master_info* mi,
bool inverse);
326 void set_slave_thread_options(THD* thd);
327 void set_slave_thread_default_charset(THD *thd,
Relay_log_info const *rli);
329 int rotate_relay_log(Master_info* mi);
331 pthread_handler_t handle_slave_io(
void *arg);
332 pthread_handler_t handle_slave_sql(
void *arg);
333 bool net_request_file(
NET* net,
const char* fname);
335 extern bool volatile abort_loop;
336 extern Master_info *active_mi;
337 extern LIST master_list;
338 extern my_bool replicate_same_server_id;
340 extern int disconnect_slave_event_count, abort_slave_event_count ;
343 extern uint master_port, master_connect_retry, report_port;
344 extern char * master_user, *master_password, *master_host;
345 extern char *master_info_file, *relay_log_info_file, *report_user;
346 extern char *report_host, *report_password;
348 extern my_bool master_ssl;
349 extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert;
350 extern char *master_ssl_cipher, *master_ssl_key;
353 bool mts_checkpoint_routine(
Relay_log_info *rli, ulonglong period,
354 bool force,
bool need_data_lock);