MySQL  8.0.18
Source Code Documentation
rpl_slave.h File Reference
#include <limits.h>
#include <sys/types.h>
#include <atomic>
#include "m_string.h"
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_psi_config.h"
#include "my_thread.h"
#include "mysql/components/services/psi_thread_bits.h"
#include "mysql_com.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"

Go to the source code of this file.


 MASTER_DELAY can be at most (1 << 31) - 1. More...
 Some of defines are need in parser even though replication is not compiled in (embedded). More...
#define SLAVE_NET_TIMEOUT   60
#define MAX_SLAVE_ERROR   14000
#define MTS_WORKER_UNDEF   ((ulong)-1)
#define MTS_MAX_WORKERS   1024
#define MTS_MAX_BITS_IN_GROUP   ((1L << 19) - 8) /* 524280 */
#define SLAVE_FORCE_ALL   4
#define SLAVE_IO   1
#define SLAVE_SQL   2


typedef struct struct_slave_connection LEX_SLAVE_CONNECTION




bool start_slave_cmd (THD *thd)
 Entry point to the START SLAVE command. More...
bool stop_slave_cmd (THD *thd)
 Entry point for the STOP SLAVE command. More...
bool change_master_cmd (THD *thd)
 Entry point for the CHANGE MASTER command. More...
int change_master (THD *thd, Master_info *mi, LEX_MASTER_INFO *lex_mi, bool preserve_logs)
 Execute a CHANGE MASTER statement. More...
bool reset_slave_cmd (THD *thd)
 Entry function for RESET SLAVE command. More...
bool show_slave_status_cmd (THD *thd)
 Entry point for SHOW SLAVE STATUS command. More...
bool flush_relay_logs_cmd (THD *thd)
 Entry point for FLUSH RELAYLOGS command or to flush relaylogs for the FLUSH LOGS command. More...
bool reencrypt_relay_logs ()
 Re-encrypt previous relay logs with current master key for all slave channels. More...
int flush_relay_logs (Master_info *mi, THD *thd)
 flushes the relay logs of a replication channel. More...
int reset_slave (THD *thd, Master_info *mi, bool reset_all)
 Execute a RESET SLAVE statement. More...
int reset_slave (THD *thd)
 Execute a RESET SLAVE (for all channels), used in Multisource replication. More...
int init_slave ()
int init_recovery (Master_info *mi)
int load_mi_and_rli_from_repositories (Master_info *mi, bool ignore_if_no_info, int thread_mask, bool skip_received_gtid_set_recovery=false)
 Call mi->init_info() and/or mi->rli->init_info(), which will read the replication configuration from repositories. More...
void end_info (Master_info *mi)
int remove_info (Master_info *mi)
int flush_master_info (Master_info *mi, bool force, bool need_lock, bool do_flush_relay_log)
void add_slave_skip_errors (const char *arg)
void set_slave_skip_errors (char **slave_skip_errors_ptr)
Change arg to the string with the nice, human-readable skip error values. More...
int add_new_channel (Master_info **mi, const char *channel)
 This function is first called when the Master_info object corresponding to a channel in a multisourced slave does not exist. More...
int terminate_slave_threads (Master_info *mi, int thread_mask, ulong stop_wait_timeout, bool need_lock_term=true)
 Terminates the slave threads according to the given mask. More...
bool start_slave_threads (bool need_lock_slave, bool wait_for_start, Master_info *mi, int thread_mask)
bool start_slave (THD *thd)
 Function to start a slave for all channels. More...
int stop_slave (THD *thd)
 Function to stop a slave for all channels. More...
bool start_slave (THD *thd, LEX_SLAVE_CONNECTION *connection_param, LEX_MASTER_INFO *master_param, int thread_mask_input, Master_info *mi, bool set_mts_settings)
 Executes a START SLAVE statement. More...
int stop_slave (THD *thd, Master_info *mi, bool net_report, bool for_one_channel, bool *push_temp_tables_warning)
 Execute a STOP SLAVE statement. More...
bool start_slave_thread (PSI_thread_key thread_key, my_start_routine h_func, mysql_mutex_t *start_lock, mysql_mutex_t *cond_lock, mysql_cond_t *start_cond, std::atomic< uint > *slave_running, std::atomic< ulong > *slave_run_id, Master_info *mi)
bool show_slave_status (THD *thd, Master_info *mi)
 Execute a SHOW SLAVE STATUS statement. More...
bool show_slave_status (THD *thd)
 Method to the show the replication status in all channels. More...
bool rpl_master_has_bug (const Relay_log_info *rli, uint bug_id, bool report, bool(*pred)(const void *), const void *param)
 Detects, based on master's version (as found in the relay log), if master has a certain bug. More...
bool rpl_master_erroneous_autoinc (THD *thd)
 BUG#33029, For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, if one statement in a SP generated AUTO_INCREMENT value by the top statement, all statements after it would be considered generated AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID value might be associated with these statement, which could cause duplicate entry error and stop the slave. More...
const char * print_slave_db_safe (const char *db)
void end_slave ()
void delete_slave_info_objects ()
 Free all resources used by slave threads at time of executing shutdown. More...
void lock_slave_threads (Master_info *mi)
 This method locks both (in this order) mi->run_lock rli->run_lock. More...
void unlock_slave_threads (Master_info *mi)
void init_thread_mask (int *mask, Master_info *mi, bool inverse)
void set_slave_thread_options (THD *thd)
 Set slave thread default options. More...
void set_slave_thread_default_charset (THD *thd, Relay_log_info const *rli)
int rotate_relay_log (Master_info *mi, bool log_master_fd, bool need_lock, bool need_log_space_lock)
QUEUE_EVENT_RESULT queue_event (Master_info *mi, const char *buf, ulong event_len, bool do_flush_mi)
 Store an event received from the master connection into the relay log. More...
void * handle_slave_io (void *arg)
 Slave IO thread entry point. More...
void * handle_slave_sql (void *arg)
 Slave SQL thread entry point. More...
bool net_request_file (NET *net, const char *fname)
bool mts_recovery_groups (Relay_log_info *rli)
bool mts_checkpoint_routine (Relay_log_info *rli, bool force)
 Processing rli->gaq to find out the low-water-mark (lwm) coordinates which is stored into the central recovery table. More...
bool sql_slave_killed (THD *thd, Relay_log_info *rli)
 The function analyzes a possible killed status and makes a decision whether to accept it or not. More...


bool server_id_supplied
ulong master_retry_count
MY_BITMAP slave_error_mask
char slave_skip_error_names []
bool use_slave_mask
char * slave_load_tmpdir
const char * master_info_file
const char * relay_log_info_file
char * opt_relay_logname
char * opt_relaylog_index_name
bool opt_relaylog_index_name_supplied
bool opt_relay_logname_supplied
char * opt_binlog_index_name
bool opt_skip_slave_start
 If set, slave is not autostarted. More...
bool opt_log_slave_updates
char * opt_slave_skip_errors
ulonglong relay_log_space_limit
const char * relay_log_index
const char * relay_log_basename
bool replicate_same_server_id
int disconnect_slave_event_count
int abort_slave_event_count
uint report_port
char * report_user
char * report_host
char * report_password

Macro Definition Documentation



MASTER_DELAY can be at most (1 << 31) - 1.

Typedef Documentation


Enumeration Type Documentation