65#define SOURCE_DELAY_MAX (0x7FFFFFFF)
66#if INT_MAX < 0x7FFFFFFF
67#error "don't support platforms where INT_MAX < 0x7FFFFFFF"
85#define REPLICA_MAX_HEARTBEAT_PERIOD 4294967
87#define REPLICA_NET_TIMEOUT 60
89#define MAX_SLAVE_ERROR 14000
91#define MTS_WORKER_UNDEF ((ulong)-1)
92#define MTS_MAX_WORKERS 1024
93#define MAX_SLAVE_RETRY_PAUSE 5
101#define MTS_MAX_BITS_IN_GROUP ((1L << 19) - 8)
422#define MYSQL_SLAVE_NOT_RUN 0
423#define MYSQL_SLAVE_RUN_NOT_CONNECT 1
424#define MYSQL_SLAVE_RUN_CONNECT 2
430#define SLAVE_FORCE_ALL 4
437 bool preserve_logs =
false);
480 Master_info *mi,
bool ignore_if_no_info,
int thread_mask,
481 bool skip_received_gtid_set_and_relaylog_recovery =
false,
482 bool force_load =
false);
530 bool flush_relay_log =
true,
531 bool skip_repo_persistence =
false);
558 ulong stop_wait_timeout,
559 bool need_lock_term =
true);
568 bool *push_temp_table_warning);
578 std::atomic<uint> *slave_running,
579 std::atomic<ulong> *slave_run_id,
Master_info *mi);
606 bool need_lock =
true,
bool need_log_space_lock =
true);
613 ulong event_len,
bool flush_mi =
true);
616 std::string binlog_name, uint64_t position,
617 unsigned long &inc_pos,
bool &do_flush_mi);
644 bool suppress_warnings,
645 const std::string &
host = std::string(),
646 const uint
port = 0,
bool is_io_thread =
true);
Definition: rpl_rli.h:206
Helper class used to initialize the replica (includes init_replica())
Definition: rpl_replica.h:369
int m_init_code
Replica initialization error code.
Definition: rpl_replica.h:409
int m_thread_mask
Thread mask indicating type of the thread.
Definition: rpl_replica.h:410
bool m_opt_skip_replica_start
Indicates whether replica threads should be started or not.
Definition: rpl_replica.h:407
bool m_opt_initialize_replica
Indicates whether to initialize replica.
Definition: rpl_replica.h:405
The class is a container for all the per-channel filters, both a map of Rpl_filter objects and a list...
Definition: rpl_msr.h:684
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
bool stop_slave_cmd(THD *thd)
Entry point for the STOP REPLICA command.
Definition: rpl_replica.cc:835
char * replica_load_tmpdir
Definition: rpl_replica.cc:194
QUEUE_EVENT_RESULT
Definition: rpl_replica.h:607
bool opt_log_replica_updates
Definition: mysqld.cc:1257
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.
Definition: rpl_replica.cc:2272
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)
Definition: rpl_replica.cc:7435
const char * relay_log_basename
Definition: rpl_replica.cc:199
bool net_request_file(NET *net, const char *fname)
Definition: rpl_replica.cc:2379
bool start_slave_threads(bool need_lock_slave, bool wait_for_start, Master_info *mi, int thread_mask)
Definition: rpl_replica.cc:2064
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...
Definition: rpl_replica.cc:6408
void clear_info(Master_info *mi)
Clear the information regarding the Master_info and Relay_log_info objects represented by the paramet...
Definition: rpl_replica.cc:1407
ulong source_retry_count
Definition: mysqld.cc:1658
void set_replica_skip_errors(char **replica_skip_errors_ptr)
Change arg to the string with the nice, human-readable skip error values.
Definition: rpl_replica.cc:1594
void start_threads()
This function starts replication threads.
Definition: rpl_replica.cc:507
bool change_master_cmd(THD *thd)
Entry point for the CHANGE REPLICATION SOURCE command.
Definition: rpl_replica.cc:10960
int load_mi_and_rli_from_repositories(Master_info *mi, bool ignore_if_no_info, int thread_mask, bool skip_received_gtid_set_and_relaylog_recovery, bool force_load)
Call mi->init_info() and/or mi->rli->init_info(), which will read the replication configuration from ...
Definition: rpl_replica.cc:1285
char * opt_relay_logname
Definition: mysqld.cc:1660
void end_info(Master_info *mi)
Definition: rpl_replica.cc:1395
bool replicate_same_server_id
Definition: rpl_replica.cc:195
int init_replica_thread(THD *thd, SLAVE_THD_TYPE thd_type)
Definition: rpl_replica.cc:4036
int remove_info(Master_info *mi)
Definition: rpl_replica.cc:1427
char * report_password
Definition: rpl_replica.h:654
ReplicaInitializer(bool opt_initialize, bool opt_skip_replica_start, Rpl_channel_filters &filters, char **replica_skip_erors)
Constructor, calls init_replica()
Definition: rpl_replica.cc:437
const char * print_slave_db_safe(const char *db)
Definition: rpl_replica.cc:2392
bool reencrypt_relay_logs()
Re-encrypt previous relay logs with current master key for all slave channels.
Definition: rpl_replica.cc:8716
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.
Definition: rpl_replica.cc:7538
void disable_applier_metric_collection()
Disables metric collection for replication structures It affects new and already created and running ...
Definition: rpl_replica.cc:11339
bool flush_relay_logs_cmd(THD *thd)
Entry point for FLUSH RELAYLOGS command or to flush relaylogs for the FLUSH LOGS command.
Definition: rpl_replica.cc:8648
char * report_user
Definition: mysqld.cc:1659
static void init_replica_psi_keys()
Initializes replica PSI keys in case PSI interface is available.
Definition: rpl_replica.cc:545
int stop_slave(THD *thd)
Function to stop a slave for all channels.
Definition: rpl_replica.cc:689
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 multisource...
Definition: rpl_replica.cc:10808
void * handle_slave_io(void *arg)
Slave IO thread entry point.
Definition: rpl_replica.cc:5297
bool reset_slave_cmd(THD *thd)
Entry function for RESET REPLICA command.
Definition: rpl_replica.cc:9291
bool is_network_error(uint errorno)
Definition: rpl_replica.cc:2398
void add_replica_skip_errors(const char *arg)
Definition: rpl_replica.cc:1643
void enable_applier_metric_collection()
Enables metric collection for replication structures It affects new and already created and running c...
Definition: rpl_replica.cc:11335
ulonglong relay_log_space_limit
Definition: rpl_replica.cc:196
bool opt_skip_replica_start
If set, slave is not autostarted.
Definition: mysqld.cc:1252
int rotate_relay_log(Master_info *mi, bool log_master_fd, bool need_lock, bool need_log_space_lock)
Rotates the relay log.
Definition: rpl_replica.cc:8542
void start_replication_threads(bool skip_replica_start=true)
This function starts replication threads.
Definition: rpl_replica.cc:501
bool show_slave_status(THD *thd)
Method to the show the replication status in all channels.
Definition: rpl_replica.cc:3726
void print_channel_info() const
In case debug mode is on, prints channel information.
Definition: rpl_replica.cc:480
bool reset_info(Master_info *mi)
Resets the information regarding the Master_info and Relay_log_info objects represented by the parame...
Definition: rpl_replica.cc:1448
bool opt_collect_replica_applier_metrics
Definition: mysqld.cc:1260
const char * relay_log_index
Definition: rpl_replica.cc:198
int init_replica()
Performs replica initialization, creates default replication channel and sets channel filters.
Definition: rpl_replica.cc:558
int flush_relay_logs(Master_info *mi, THD *thd)
flushes the relay logs of a replication channel.
Definition: rpl_replica.cc:8602
void delete_slave_info_objects()
Free all resources used by slave threads at time of executing shutdown.
Definition: rpl_replica.cc:2191
bool mts_recovery_groups(Relay_log_info *rli)
Definition: rpl_replica.cc:6152
int change_master(THD *thd, Master_info *mi, LEX_SOURCE_INFO *lex_mi, bool preserve_logs)
Execute a CHANGE REPLICATION SOURCE statement.
Definition: rpl_replica.cc:10454
bool start_slave_cmd(THD *thd)
Entry point to the START REPLICA command.
Definition: rpl_replica.cc:736
int flush_master_info(Master_info *mi, bool force, bool need_lock, bool do_flush_relay_log, bool skip_repo_persistence)
This method flushes the current configuration for the channel into the connection metadata repository...
Definition: rpl_replica.cc:1483
char * report_host
Definition: mysqld.cc:1659
uint report_port
Definition: mysqld.cc:1657
bool opt_relaylog_index_name_supplied
Definition: mysqld.cc:1665
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)
Definition: rpl_replica.cc:1988
void set_slave_thread_options(THD *thd)
Set slave thread default options.
Definition: rpl_replica.cc:3967
int get_initialization_code() const
Gets initialization code set-up at replica initialization.
Definition: rpl_replica.cc:435
bool server_id_supplied
Definition: mysqld.cc:1212
char * opt_relaylog_index_name
Definition: rpl_replica.h:354
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)
Definition: rpl_replica.cc:8315
int terminate_slave_threads(Master_info *mi, int thread_mask, ulong stop_wait_timeout, bool need_lock_term)
Terminates the slave threads according to the given mask.
Definition: rpl_replica.cc:1715
int init_recovery(Master_info *mi)
Definition: rpl_replica.cc:1165
char slave_skip_error_names[]
Definition: rpl_replica.cc:192
void end_slave()
Definition: rpl_replica.cc:2160
MY_BITMAP slave_error_mask
Definition: rpl_replica.cc:191
char * opt_binlog_index_name
Definition: mysqld.cc:1689
bool show_slave_status_cmd(THD *thd)
Entry point for SHOW REPLICA STATUS command.
Definition: rpl_replica.cc:3922
void * handle_slave_sql(void *arg)
Slave SQL thread entry point.
Definition: rpl_replica.cc:6914
bool use_slave_mask
Definition: rpl_replica.cc:190
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli)
Definition: rpl_replica.cc:4013
bool opt_relay_logname_supplied
Definition: mysqld.cc:1670
bool start_slave(THD *thd)
Function to start a slave for all channels.
Definition: rpl_replica.cc:626
char * opt_replica_skip_errors
Definition: mysqld.cc:1258
@ QUEUE_EVENT_OK
Definition: rpl_replica.h:608
@ QUEUE_EVENT_ERROR_QUEUING
Definition: rpl_replica.h:609
@ QUEUE_EVENT_ERROR_FLUSHING_INFO
Definition: rpl_replica.h:610
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:50
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
Defines to make different thread packages compatible.
void *(* my_start_routine)(void *)
Definition: my_thread.h:72
static int reconnect()
Definition: mysql.cc:3375
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
Common definition between mysql server & client.
const char * host
Definition: mysqladmin.cc:65
bool opt_initialize
Definition: mysqld.cc:1251
Definition: buf0block_hint.cc:30
constexpr value_type reset_slave
Definition: classic_protocol_constants.h:314
bool is_valid(const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, bool *is_valid) noexcept
Decides if a geometry is valid.
Definition: is_valid.cc:95
Definition: instrumented_condition_variable.h:32
Performance schema instrumentation interface.
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
const long mts_online_stat_period
Definition: rpl_replica.h:51
SLAVE_THD_TYPE
Definition: rpl_replica.h:55
@ SLAVE_THD_SQL
Definition: rpl_replica.h:57
@ SLAVE_THD_IO
Definition: rpl_replica.h:56
@ SLAVE_THD_WORKER
Definition: rpl_replica.h:58
@ SLAVE_THD_MONITOR
Definition: rpl_replica.h:59
Declarations for the Debug Sync Facility.
Structure to hold parameters for CHANGE REPLICATION SOURCE, START REPLICA, and STOP REPLICA.
Definition: sql_lex.h:354
Definition: my_bitmap.h:43
Definition: mysql_com.h:914
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: sql_lex.h:2567