MySQL 8.3.0
Source Code Documentation
rpl_replica.h File Reference
#include <limits.h>
#include <sys/types.h>
#include <atomic>
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_psi_config.h"
#include "my_thread.h"
#include "mysql.h"
#include "mysql/components/services/bits/psi_thread_bits.h"
#include "mysql_com.h"
#include "sql/changestreams/apply/constants.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"

Go to the source code of this file.


class  ReplicaInitializer
 Helper class used to initialize the replica (includes init_replica()) More...


 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 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


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 REPLICA 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 REPLICA statement. More...
int reset_slave (THD *thd)
 Execute a RESET SLAVE (for all channels), used in Multisource replication. More...
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, bool force_load=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)
void clear_info (Master_info *mi)
 Clear the information regarding the Master_info and Relay_log_info objects represented by the parameter, meaning, setting to NULL all attributes that are not meant to be kept between slave resets. More...
int remove_info (Master_info *mi)
bool reset_info (Master_info *mi)
 Resets the information regarding the Master_info and Relay_log_info objects represented by the parameter, meaning, setting to NULL all attributes that are not meant to be kept between slave resets and persisting all other attribute values in the repository. More...
int flush_master_info (Master_info *mi, bool force, bool need_lock=true, bool flush_relay_log=true, bool skip_repo_persistence=false)
 This method flushes the current configuration for the channel into the connection metadata repository. More...
void add_replica_skip_errors (const char *arg)
void set_replica_skip_errors (char **replica_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 REPLICA STATUS statement. More...
bool show_slave_status (THD *thd)
 Method to the show the replication status in all channels. 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 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...
int heartbeat_queue_event (bool is_valid, Master_info *&mi, std::string binlog_name, uint64_t position, unsigned long &inc_pos, bool &do_flush_mi)
void * handle_slave_io (void *arg)
 Slave IO thread entry point. More...
void * handle_slave_sql (void *arg)
 Slave SQL thread entry point. More...
int connect_to_master (THD *thd, MYSQL *mysql, Master_info *mi, bool reconnect, bool suppress_warnings, const std::string &host, const uint port, bool is_io_thread)
bool net_request_file (NET *net, const char *fname)
bool mts_recovery_groups (Relay_log_info *rli)
bool mta_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 is_network_error (uint errorno)
int init_replica_thread (THD *thd, SLAVE_THD_TYPE thd_type)


const long mts_online_stat_period = 60 * 2
const long mts_online_stat_count = 1024
bool server_id_supplied
ulong master_retry_count
MY_BITMAP slave_error_mask
char slave_skip_error_names []
bool use_slave_mask
char * replica_load_tmpdir
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_replica_start
 If set, slave is not autostarted. More...
bool opt_log_replica_updates
char * opt_replica_skip_errors
ulonglong relay_log_space_limit
const char * relay_log_index
const char * relay_log_basename
bool replicate_same_server_id
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



Variable Documentation

◆ mts_online_stat_count

const long mts_online_stat_count = 1024

◆ mts_online_stat_period

const long mts_online_stat_period = 60 * 2