64#define MASTER_DELAY_MAX (0x7FFFFFFF)
65#if INT_MAX < 0x7FFFFFFF
66#error "don't support platforms where INT_MAX < 0x7FFFFFFF"
84#define SLAVE_MAX_HEARTBEAT_PERIOD 4294967
86#define REPLICA_NET_TIMEOUT 60
88#define MAX_SLAVE_ERROR 14000
90#define MTS_WORKER_UNDEF ((ulong)-1)
91#define MTS_MAX_WORKERS 1024
92#define MAX_SLAVE_RETRY_PAUSE 5
100#define MTS_MAX_BITS_IN_GROUP ((1L << 19) - 8)
423#define MYSQL_SLAVE_NOT_RUN 0
424#define MYSQL_SLAVE_RUN_NOT_CONNECT 1
425#define MYSQL_SLAVE_RUN_CONNECT 2
431#define SLAVE_FORCE_ALL 4
438 bool preserve_logs =
false);
481 Master_info *mi,
bool ignore_if_no_info,
int thread_mask,
482 bool skip_received_gtid_set_recovery =
false,
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:203
Helper class used to initialize the replica (includes init_replica())
Definition: rpl_replica.h:370
int m_init_code
Replica initialization error code.
Definition: rpl_replica.h:410
int m_thread_mask
Thread mask indicating type of the thread.
Definition: rpl_replica.h:411
bool m_opt_skip_replica_start
Indicates whether replica threads should be started or not.
Definition: rpl_replica.h:408
bool m_opt_initialize_replica
Indicates whether to initialize replica.
Definition: rpl_replica.h:406
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:473
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Declarations for the Debug Sync Facility.
bool stop_slave_cmd(THD *thd)
Entry point for the STOP SLAVE command.
Definition: rpl_replica.cc:833
char * replica_load_tmpdir
Definition: rpl_replica.cc:186
QUEUE_EVENT_RESULT
Definition: rpl_replica.h:607
bool opt_log_replica_updates
Definition: mysqld.cc:1233
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:2278
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:7496
const char * relay_log_basename
Definition: rpl_replica.cc:191
bool net_request_file(NET *net, const char *fname)
Definition: rpl_replica.cc:2385
bool start_slave_threads(bool need_lock_slave, bool wait_for_start, Master_info *mi, int thread_mask)
Definition: rpl_replica.cc:2065
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:6451
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:1405
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:1595
void start_threads()
This function starts replication threads.
Definition: rpl_replica.cc:510
bool change_master_cmd(THD *thd)
Entry point for the CHANGE MASTER command.
Definition: rpl_replica.cc:10984
char * opt_relay_logname
Definition: mysqld.cc:1653
void end_info(Master_info *mi)
Definition: rpl_replica.cc:1393
bool replicate_same_server_id
Definition: rpl_replica.cc:187
int init_replica_thread(THD *thd, SLAVE_THD_TYPE thd_type)
Definition: rpl_replica.cc:4052
int remove_info(Master_info *mi)
Definition: rpl_replica.cc:1425
char * report_password
Definition: rpl_replica.h:659
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:440
const char * print_slave_db_safe(const char *db)
Definition: rpl_replica.cc:2398
ulong master_retry_count
Definition: mysqld.cc:1649
int change_master(THD *thd, Master_info *mi, LEX_MASTER_INFO *lex_mi, bool preserve_logs)
Execute a CHANGE MASTER statement.
Definition: rpl_replica.cc:10470
bool reencrypt_relay_logs()
Re-encrypt previous relay logs with current master key for all slave channels.
Definition: rpl_replica.cc:8747
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:7601
int disconnect_slave_event_count
Definition: rpl_replica.cc:237
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:8679
char * report_user
Definition: mysqld.cc:1652
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:688
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:10819
void * handle_slave_io(void *arg)
Slave IO thread entry point.
Definition: rpl_replica.cc:5329
bool reset_slave_cmd(THD *thd)
Entry function for RESET SLAVE command.
Definition: rpl_replica.cc:9300
bool is_network_error(uint errorno)
Definition: rpl_replica.cc:2404
void add_replica_skip_errors(const char *arg)
Definition: rpl_replica.cc:1644
ulonglong relay_log_space_limit
Definition: rpl_replica.cc:188
bool opt_skip_replica_start
If set, slave is not autostarted.
Definition: mysqld.cc:1228
const char * relay_log_info_file
Definition: rpl_replica.h:657
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:8574
void start_replication_threads(bool skip_replica_start=true)
This function starts replication threads.
Definition: rpl_replica.cc:504
bool show_slave_status(THD *thd)
Method to the show the replication status in all channels.
Definition: rpl_replica.cc:3732
void print_channel_info() const
In case debug mode is on, prints channel information.
Definition: rpl_replica.cc:483
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:1446
int load_mi_and_rli_from_repositories(Master_info *mi, bool ignore_if_no_info, int thread_mask, bool skip_received_gtid_set_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:1283
const char * relay_log_index
Definition: rpl_replica.cc:190
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:8634
void delete_slave_info_objects()
Free all resources used by slave threads at time of executing shutdown.
Definition: rpl_replica.cc:2192
bool mts_recovery_groups(Relay_log_info *rli)
Definition: rpl_replica.cc:6197
bool start_slave_cmd(THD *thd)
Entry point to the START SLAVE command.
Definition: rpl_replica.cc:735
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:1484
char * report_host
Definition: mysqld.cc:1652
uint report_port
Definition: mysqld.cc:1648
bool opt_relaylog_index_name_supplied
Definition: mysqld.cc:1658
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:1989
void set_slave_thread_options(THD *thd)
Set slave thread default options.
Definition: rpl_replica.cc:3981
int get_initialization_code() const
Gets initialization code set-up at replica initialization.
Definition: rpl_replica.cc:438
bool server_id_supplied
Definition: mysqld.cc:1188
int abort_slave_event_count
Definition: rpl_replica.h:652
char * opt_relaylog_index_name
Definition: rpl_replica.h:356
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:8343
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:1716
int init_recovery(Master_info *mi)
Definition: rpl_replica.cc:1163
char slave_skip_error_names[]
Definition: rpl_replica.cc:184
void end_slave()
Definition: rpl_replica.cc:2161
MY_BITMAP slave_error_mask
Definition: rpl_replica.cc:183
char * opt_binlog_index_name
Definition: mysqld.cc:1687
bool show_slave_status_cmd(THD *thd)
Entry point for SHOW REPLICA STATUS command.
Definition: rpl_replica.cc:3936
void * handle_slave_sql(void *arg)
Slave SQL thread entry point.
Definition: rpl_replica.cc:6965
const char * master_info_file
Definition: rpl_replica.h:656
bool use_slave_mask
Definition: rpl_replica.cc:182
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli)
Definition: rpl_replica.cc:4029
bool opt_relay_logname_supplied
Definition: mysqld.cc:1663
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:1234
@ 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(void)
Definition: mysql.cc:3045
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:59
bool opt_initialize
Definition: mysqld.cc:1227
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
SLAVE_THD_TYPE
Definition: rpl_replica.h:54
@ SLAVE_THD_SQL
Definition: rpl_replica.h:56
@ SLAVE_THD_IO
Definition: rpl_replica.h:55
@ SLAVE_THD_WORKER
Definition: rpl_replica.h:57
@ SLAVE_THD_MONITOR
Definition: rpl_replica.h:58
Structure to hold parameters for CHANGE MASTER, START SLAVE, and STOP SLAVE.
Definition: sql_lex.h:350
Definition: my_bitmap.h:43
Definition: mysql_com.h:913
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: sql_lex.h:2457
unsigned int uint
Definition: uca9-dump.cc:75