MySQL 9.1.0
Source Code Documentation
Master_info Class Reference

#include <rpl_mi.h>

Inheritance diagram for Master_info:
[legend]

Public Member Functions

bool is_start_user_configured () const
 Returns if USER/PASSWORD was specified when running START REPLICA. More...
 
bool is_start_plugin_auth_configured () const
 Returns if DEFAULT_AUTH was specified when running START REPLICA. More...
 
bool is_start_plugin_dir_configured () const
 Returns if PLUGIN_DIR was specified when running START REPLICA. More...
 
void set_start_user_configured (bool config)
 Defines that USER/PASSWORD was specified or not when running START REPLICA. More...
 
void set_user (const char *user_arg)
 Sets either user's name in the master.info repository when CHANGE MASTER is executed or user's name used in START REPLICA if USER is specified. More...
 
size_t get_user_size () const
 Returns user's size name. More...
 
const char * get_user () const
 If an user was specified when running START REPLICA, this function returns such user. More...
 
void set_password (const char *password_arg)
 Stores either user's password in the master.info repository when CHANGE MASTER is executed or user's password used in START REPLICA if PASSWORD is specified. More...
 
bool get_password (char *password_arg, size_t *password_arg_size)
 Returns either user's password in the master.info repository or user's password used in START REPLICA. More...
 
void reset_start_info ()
 Cleans in-memory password defined by START REPLICA. More...
 
const char * get_start_plugin_auth ()
 Returns the DEFAULT_AUTH defined by START REPLICA. More...
 
const char * get_start_plugin_dir ()
 Returns the PLUGIN_DIR defined by START REPLICA. More...
 
void set_plugin_auth (const char *src)
 Stores the DEFAULT_AUTH defined by START REPLICA. More...
 
void set_plugin_dir (const char *src)
 Stores the DEFAULT_AUTH defined by START REPLICA. More...
 
bool is_set_network_namespace () const
 
const char * network_namespace_str () const
 
int mi_init_info ()
 Creates or reads information from the repository, initializing the Master_info. More...
 
void end_info ()
 
int flush_info (bool force=false)
 Store the master file and position where the slave's I/O thread are in the relay log. More...
 
void set_relay_log_info (Relay_log_info *info)
 
bool shall_ignore_server_id (ulong s_id)
 Reports if the s_id server has been configured to ignore events it generates with. More...
 
Gtid_monitoring_infoget_gtid_monitoring_info ()
 
void started_queueing (Gtid gtid_arg, ulonglong original_ts_arg, ulonglong immediate_ts_arg)
 Stores the details of the transaction the receiver thread has just started queueing. More...
 
void finished_queueing ()
 Track statistics after the receiver has finished queueing a transaction. More...
 
bool is_queueing_trx ()
 
const Gtidget_queueing_trx_gtid ()
 
void clear_queueing_trx (bool need_lock=false)
 Clears the processing_trx monitoring info. More...
 
void clear_gtid_monitoring_info (bool need_lock=false)
 Clears all GTID monitoring info. More...
 
 ~Master_info () override
 
void request_rotate (THD *thd)
 Sets the flag that indicates that a relay log rotation has been requested. More...
 
void clear_rotate_requests ()
 Clears the flag that indicates that a relay log rotation has been requested and notifies requester that the rotation has finished. More...
 
bool is_rotate_requested ()
 Checks whether or not there is a request for rotating the underlying relay log. More...
 
const char * get_master_log_name () const
 
const char * get_master_log_name_info () const
 
ulonglong get_master_log_pos () const
 
ulonglong get_master_log_pos_info () const
 
void set_master_log_name (const char *log_file_name)
 
void set_master_log_pos (ulonglong log_pos)
 
const char * get_io_rpl_log_name ()
 
bool is_auto_position ()
 
void set_auto_position (bool auto_position_param)
 
bool is_source_connection_auto_failover ()
 Checks if Asynchronous Replication Connection Failover feature is enabled. More...
 
void set_source_connection_auto_failover ()
 Enable Asynchronous Replication Connection Failover feature. More...
 
void unset_source_connection_auto_failover ()
 Disable Asynchronous Replication Connection Failover feature. More...
 
uint get_failover_list_position ()
 Return current position in the Failover source list for the Asynchronous Replication Connection Failover feature. More...
 
void reset_failover_list_position ()
 Reset current position to 0, when new failover source list is fetched. More...
 
void increment_failover_list_position ()
 Increment current position, so next failover source can be selected on failure. More...
 
bool is_network_error ()
 Checks if network error has occurred. More...
 
void set_network_error ()
 Sets m_network_error to true. More...
 
void reset_network_error ()
 Resets m_network_error to false. More...
 
bool is_ignore_server_ids_configured ()
 This member function shall return true if there are server ids configured to be ignored. More...
 
Format_description_log_eventget_mi_description_event ()
 
void set_mi_description_event (Format_description_log_event *fdle)
 
bool set_info_search_keys (Rpl_info_handler *to) override
 To search in the slave repositories, each slave info object (mi, rli or worker) should use a primary key. More...
 
const char * get_for_channel_str (bool upper_case=false) const override
 
void init_master_log_pos ()
 
void channel_rdlock ()
 Acquire the channel read lock. More...
 
void channel_wrlock ()
 Acquire the channel write lock. More...
 
int channel_trywrlock ()
 Try to acquire the write lock, and fail if it cannot be immediately granted. More...
 
void channel_unlock ()
 Release the channel lock (whether it is a write or read lock). More...
 
void channel_assert_some_lock () const
 Assert that some thread holds either the read or the write lock. More...
 
void channel_assert_some_wrlock () const
 Assert that some thread holds the write lock. More...
 
void inc_reference ()
 Increase the reference count to prohibit deleting a channel. More...
 
void dec_reference ()
 Decrease the reference count. More...
 
void wait_until_no_reference (THD *thd)
 It mush be called before deleting a channel and protected by channel_map_lock.wrlock(). More...
 
void update_flushed_relay_log_info ()
 Sync flushed_relay_log_info with current relay log coordinates. More...
 
void get_flushed_relay_log_info (Log_info *linfo)
 Collect relay log coordinates (file name and position) that related to the last Master_info master coordinates flushed into the repository. More...
 
void set_receiver_position_info_invalid (bool invalid)
 Marks the receiver position information (master_log_name, master_log_pos) as being invalid or not. More...
 
bool is_receiver_position_info_invalid () const
 Returns if receiver position information is valid or invalid. More...
 
void set_gtid_only_mode (bool gtid_only_mode)
 Enable or disable the gtid_only mode. More...
 
bool is_gtid_only_mode () const
 Returns if gtid_only is enabled or not. More...
 
void set_applier_metric_collection_status (bool value)
 Enable or disable metric collection. More...
 
bool is_metric_collection_enabled ()
 Returns if metric collection is enabled on this channel. More...
 
- Public Member Functions inherited from Rpl_info
 ~Rpl_info () override
 
void set_rpl_info_handler (Rpl_info_handler *param_handler)
 Sets the persistency component/handler. More...
 
Rpl_info_handlerget_rpl_info_handler ()
 Gets the persistency component/handler. More...
 
enum_return_check check_info () const
 
int remove_info ()
 
int clean_info ()
 
bool is_transactional () const
 
bool update_is_transactional ()
 
char * get_description_info () const
 
bool copy_info (Rpl_info_handler *from, Rpl_info_handler *to)
 
uint get_internal_id () const
 
char * get_channel () const
 
- Public Member Functions inherited from Slave_reporting_capability
 Slave_reporting_capability (char const *thread_name)
 Constructor. More...
 
virtual void report (loglevel level, int err_code, const char *msg,...) const
 Writes a message and, if it's an error message, to Last_Error (which will be displayed by SHOW REPLICA STATUS). More...
 
virtual void report (loglevel level, int err_code, const Gtid_specification *gtid_next, const char *msg,...) const
 
void va_report (loglevel level, int err_code, const char *prefix_msg, const char *msg, va_list v_args) const
 
void clear_error ()
 Clear errors. More...
 
int has_temporary_error (THD *thd, uint error_arg=0, bool *silent=nullptr) const
 Check if the current error is of temporary nature or not. More...
 
Error const & last_error () const
 
bool is_error () const
 
virtual ~Slave_reporting_capability ()=0
 

Static Public Member Functions

static bool is_configured (Master_info *mi)
 
static size_t get_number_info_mi_fields ()
 
static uint get_channel_field_num ()
 returns the column number of a channel in the TABLE repository. More...
 
static const char ** get_table_pk_field_names ()
 Returns an array with the expected column names of the primary key fields of the table repository. More...
 
static const uint * get_table_pk_field_indexes ()
 Returns an array with the expected column numbers of the primary key fields of the table repository. More...
 
static void set_nullable_fields (MY_BITMAP *nullable_fields)
 Sets bits for columns that are allowed to be NULL. More...
 

Public Attributes

char host [HOSTNAME_LENGTH+1]
 Host name or ip address stored in the master.info. More...
 
bool ssl
 
char ssl_ca [FN_REFLEN]
 
char ssl_capath [FN_REFLEN]
 
char ssl_cert [FN_REFLEN]
 
char ssl_cipher [FN_REFLEN]
 
char ssl_key [FN_REFLEN]
 
char tls_version [FN_REFLEN]
 
std::pair< bool, std::string > tls_ciphersuites = {true, ""}
 
char ssl_crl [FN_REFLEN]
 
char ssl_crlpath [FN_REFLEN]
 
char public_key_path [FN_REFLEN]
 
bool ssl_verify_server_cert
 
bool get_public_key
 
MYSQLmysql
 
uint32 file_id
 
Relay_log_inforli
 
uint port
 
uint connect_retry
 
long clock_diff_with_master
 
float heartbeat_period
 
ulonglong received_heartbeats
 
ulonglong last_heartbeat
 
int64_t m_queueing_transaction_size {0}
 The decompressed size of the transaction that is currently in progress of being queued, if any. More...
 
int64_t m_queueing_transaction_gtid_event_size {0}
 The size of the gtid event for the transaction that is currently in progress of being queued. More...
 
Server_idsignore_server_ids
 
ulong master_id
 
mysql::binlog::event::enum_binlog_checksum_alg checksum_alg_before_fd
 
ulong retry_count
 
char master_uuid [UUID_LENGTH+1]
 
char bind_addr [HOSTNAME_LENGTH+1]
 
char network_namespace [NAME_LEN]
 
char compression_algorithm [COMPRESSION_ALGORITHM_NAME_BUFFER_SIZE]
 
int zstd_compression_level
 
NET_SERVER server_extn
 
char for_channel_str [CHANNEL_NAME_LENGTH+31]
 
char for_channel_uppercase_str [CHANNEL_NAME_LENGTH+31]
 
Replication_transaction_boundary_parser transaction_parser
 
bool reset
 
std::string m_uuid_from_host {}
 
uint m_uuid_from_port {0}
 
- Public Attributes inherited from Rpl_info
mysql_mutex_t data_lock
 
mysql_mutex_t run_lock
 
mysql_mutex_t sleep_lock
 
mysql_mutex_t info_thd_lock
 
mysql_cond_t data_cond
 
mysql_cond_t start_cond
 
mysql_cond_t stop_cond
 
mysql_cond_t sleep_cond
 
PSI_mutex_keykey_info_run_lock
 
PSI_mutex_keykey_info_data_lock
 
PSI_mutex_keykey_info_sleep_lock
 
PSI_mutex_keykey_info_thd_lock
 
PSI_mutex_keykey_info_data_cond
 
PSI_mutex_keykey_info_start_cond
 
PSI_mutex_keykey_info_stop_cond
 
PSI_mutex_keykey_info_sleep_cond
 
THDinfo_thd
 
bool inited
 
std::atomic< bool > abort_slave
 
std::atomic< uint > slave_running
 
std::atomic< ulong > slave_run_id
 
std::atomic< bool > atomic_is_stopping {false}
 
- Public Attributes inherited from Slave_reporting_capability
mysql_mutex_t err_lock
 lock used to synchronize m_last_error on 'SHOW REPLICA STATUS' More...
 

Static Public Attributes

static constexpr auto first_source_log_name = "<First log>"
 In case we start replication from the first binary log file and source log name is empty, we use first_source_log_name instead of 'master_log_name' in the error log. More...
 

Protected Attributes

char master_log_name [FN_REFLEN] {}
 
my_off_t master_log_pos
 
- Protected Attributes inherited from Rpl_info
Rpl_info_handlerhandler
 Pointer to the repository's handler. More...
 
uint internal_id
 Uniquely and internally identifies an info entry (.e.g. More...
 
char channel [CHANNEL_NAME_LENGTH+1] = {0}
 Every slave info object acts on a particular channel in Multisource Replication. More...
 
- Protected Attributes inherited from Slave_reporting_capability
Error m_last_error
 Last error produced by the I/O or SQL thread respectively. More...
 

Private Member Functions

bool read_info (Rpl_info_handler *from) override
 
bool write_info (Rpl_info_handler *to) override
 
 Master_info (PSI_mutex_key *param_key_info_run_lock, PSI_mutex_key *param_key_info_data_lock, PSI_mutex_key *param_key_info_sleep_lock, PSI_mutex_key *param_key_info_thd_lock, PSI_mutex_key *param_key_info_rotate_lock, PSI_mutex_key *param_key_info_data_cond, PSI_mutex_key *param_key_info_start_cond, PSI_mutex_key *param_key_info_stop_cond, PSI_mutex_key *param_key_info_sleep_cond, PSI_mutex_key *param_key_info_rotate_cond, uint param_id, const char *param_channel)
 
 Master_info (const Master_info &info)
 
Master_infooperator= (const Master_info &info)
 

Private Attributes

bool start_user_configured
 If true, USER/PASSWORD was specified when running START REPLICA. More...
 
char user [USERNAME_LENGTH+1]
 User's name stored in the master.info. More...
 
char password [MAX_PASSWORD_LENGTH+1]
 User's password stored in the master.info. More...
 
char start_user [USERNAME_LENGTH+1]
 User specified when running START REPLICA. More...
 
char start_password [MAX_PASSWORD_LENGTH+1]
 Password specified when running START REPLICA. More...
 
char start_plugin_auth [FN_REFLEN+1]
 Stores the authentication plugin specified when running START REPLICA. More...
 
char start_plugin_dir [FN_REFLEN+1]
 Stores the authentication plugin directory specified when running START REPLICA. More...
 
Gtid_monitoring_infogtid_monitoring_info
 Information on the current and last queued transactions. More...
 
PSI_mutex_keykey_info_rotate_lock
 PSI key for the rotate_lock More...
 
PSI_mutex_keykey_info_rotate_cond
 PSI key for the rotate_cond More...
 
mysql_mutex_t rotate_lock
 Lock to protect from rotating the relay log when in the middle of a transaction. More...
 
mysql_cond_t rotate_cond
 Waiting condition that will block the process/thread requesting a relay log rotation in the middle of a transaction. More...
 
std::atomic< bool > rotate_requested {false}
 If a rotate was requested while the relay log was in a transaction. More...
 
Format_description_log_eventmi_description_event
 Format_description_log_event for events received from the master by the IO thread and written to the tail of the relay log. More...
 
bool auto_position {false}
 
bool m_source_connection_auto_failover {false}
 
uint m_failover_list_position {0}
 
bool m_network_error {false}
 
Checkable_rwlockm_channel_lock
 
std::atomic< int32atomic_references {0}
 
Log_info flushed_relay_log_info
 
bool m_gtid_only_mode
 Is the replica working in GTID only mode, meaning it does not persist position related information when executing or queueing transactions. More...
 
bool m_is_receiver_position_info_invalid
 Are positions invalid. More...
 
bool m_is_metric_collection_enabled {false}
 Is the collection of metrics enabled? More...
 

Friends

class Rpl_info_factory
 

Additional Inherited Members

- Protected Member Functions inherited from Rpl_info
 Rpl_info (const char *type, PSI_mutex_key *param_key_info_run_lock, PSI_mutex_key *param_key_info_data_lock, PSI_mutex_key *param_key_info_sleep_lock, PSI_mutex_key *param_key_info_thd_lock, PSI_mutex_key *param_key_info_data_cond, PSI_mutex_key *param_key_info_start_cond, PSI_mutex_key *param_key_info_stop_cond, PSI_mutex_key *param_key_info_sleep_cond, uint param_id, const char *param_channel)
 
- Protected Member Functions inherited from Slave_reporting_capability
virtual void do_report (loglevel level, int err_code, const char *msg, va_list v_args) const
 
virtual void do_report (loglevel level, int err_code, const Gtid_specification *gtid_next, const char *msg, va_list v_args) const
 

Constructor & Destructor Documentation

◆ ~Master_info()

Master_info::~Master_info ( )
override

◆ Master_info() [1/2]

Master_info::Master_info ( PSI_mutex_key param_key_info_run_lock,
PSI_mutex_key param_key_info_data_lock,
PSI_mutex_key param_key_info_sleep_lock,
PSI_mutex_key param_key_info_thd_lock,
PSI_mutex_key param_key_info_rotate_lock,
PSI_mutex_key param_key_info_data_cond,
PSI_mutex_key param_key_info_start_cond,
PSI_mutex_key param_key_info_stop_cond,
PSI_mutex_key param_key_info_sleep_cond,
PSI_mutex_key param_key_info_rotate_cond,
uint  param_id,
const char *  param_channel 
)
private

◆ Master_info() [2/2]

Master_info::Master_info ( const Master_info info)
private

Member Function Documentation

◆ channel_assert_some_lock()

void Master_info::channel_assert_some_lock ( ) const
inline

Assert that some thread holds either the read or the write lock.

◆ channel_assert_some_wrlock()

void Master_info::channel_assert_some_wrlock ( ) const
inline

Assert that some thread holds the write lock.

◆ channel_rdlock()

void Master_info::channel_rdlock ( )

Acquire the channel read lock.

◆ channel_trywrlock()

int Master_info::channel_trywrlock ( )

Try to acquire the write lock, and fail if it cannot be immediately granted.

◆ channel_unlock()

void Master_info::channel_unlock ( )
inline

Release the channel lock (whether it is a write or read lock).

◆ channel_wrlock()

void Master_info::channel_wrlock ( )

Acquire the channel write lock.

◆ clear_gtid_monitoring_info()

void Master_info::clear_gtid_monitoring_info ( bool  need_lock = false)
inline

Clears all GTID monitoring info.

◆ clear_queueing_trx()

void Master_info::clear_queueing_trx ( bool  need_lock = false)
inline

Clears the processing_trx monitoring info.

Normally called when there is an error while queueing the transaction.

◆ clear_rotate_requests()

void Master_info::clear_rotate_requests ( )

Clears the flag that indicates that a relay log rotation has been requested and notifies requester that the rotation has finished.

◆ dec_reference()

void Master_info::dec_reference ( )
inline

Decrease the reference count.

Doesn't need the protection of channel_map.rdlock.

◆ end_info()

void Master_info::end_info ( )

◆ finished_queueing()

void Master_info::finished_queueing ( )
inline

Track statistics after the receiver has finished queueing a transaction.

In gtid_monitoring_info, the transaction timestamp is recorded and the information is copied to last_queued_trx and cleared from queueing_trx.

In applier_metrics, the size/count of received transactions are incremented.

◆ flush_info()

int Master_info::flush_info ( bool  force = false)

Store the master file and position where the slave's I/O thread are in the relay log.

This function should be called either from the slave I/O thread, or when the slave thread is not running.

It can also be called by any function changing the relay log, regardless of changing master positions (i.e. a FLUSH RELAY LOGS that rotates the relay log without changing master positions).

Error can happen if writing to repository fails or if flushing the repository fails.

Parameters
forcewhen true, do not respect sync period and flush information. when false, flush will only happen if it is time to flush.

◆ get_channel_field_num()

uint Master_info::get_channel_field_num ( )
static

returns the column number of a channel in the TABLE repository.

Mainly used during server startup to load the information required from the slave repository tables. See rpl_info_factory.cc

◆ get_failover_list_position()

uint Master_info::get_failover_list_position ( )
inline

Return current position in the Failover source list for the Asynchronous Replication Connection Failover feature.

Based on this position next failover source is selected.

Returns
current position in the Failover source list.

◆ get_flushed_relay_log_info()

void Master_info::get_flushed_relay_log_info ( Log_info linfo)

Collect relay log coordinates (file name and position) that related to the last Master_info master coordinates flushed into the repository.

Parameters
[out]linfoWhere the relay log coordinates shall be stored.

◆ get_for_channel_str()

const char * Master_info::get_for_channel_str ( bool  upper_case = false) const
inlineoverridevirtual

◆ get_gtid_monitoring_info()

Gtid_monitoring_info * Master_info::get_gtid_monitoring_info ( )
inline
Returns
The pointer to the Gtid_monitoring_info

◆ get_io_rpl_log_name()

const char * Master_info::get_io_rpl_log_name ( )
inline

◆ get_master_log_name()

const char * Master_info::get_master_log_name ( ) const
inline

◆ get_master_log_name_info()

const char * Master_info::get_master_log_name_info ( ) const
inline

◆ get_master_log_pos()

ulonglong Master_info::get_master_log_pos ( ) const
inline

◆ get_master_log_pos_info()

ulonglong Master_info::get_master_log_pos_info ( ) const
inline

◆ get_mi_description_event()

Format_description_log_event * Master_info::get_mi_description_event ( )
inline

◆ get_number_info_mi_fields()

size_t Master_info::get_number_info_mi_fields ( )
static

◆ get_password()

bool Master_info::get_password ( char *  password_arg,
size_t *  password_arg_size 
)

Returns either user's password in the master.info repository or user's password used in START REPLICA.

Parameters
[out]password_argis user's password.
[out]password_arg_sizeis user's password size.
Returns
false if there is no error, otherwise true is returned.

◆ get_queueing_trx_gtid()

const Gtid * Master_info::get_queueing_trx_gtid ( )
inline
Returns
The pointer to the GTID of the processing_trx of Gtid_monitoring_info.

◆ get_start_plugin_auth()

const char * Master_info::get_start_plugin_auth ( )
inline

Returns the DEFAULT_AUTH defined by START REPLICA.

Returns
DEFAULT_AUTH.

◆ get_start_plugin_dir()

const char * Master_info::get_start_plugin_dir ( )
inline

Returns the PLUGIN_DIR defined by START REPLICA.

Returns
PLUGIN_DIR.

◆ get_table_pk_field_indexes()

const uint * Master_info::get_table_pk_field_indexes ( )
static

Returns an array with the expected column numbers of the primary key fields of the table repository.

◆ get_table_pk_field_names()

static const char ** Master_info::get_table_pk_field_names ( )
static

Returns an array with the expected column names of the primary key fields of the table repository.

◆ get_user()

const char * Master_info::get_user ( ) const
inline

If an user was specified when running START REPLICA, this function returns such user.

Otherwise, it returns the user stored in master.info.

Returns
user's name.

◆ get_user_size()

size_t Master_info::get_user_size ( ) const
inline

Returns user's size name.

See get_user().

Returns
user's size name.

◆ inc_reference()

void Master_info::inc_reference ( )
inline

Increase the reference count to prohibit deleting a channel.

This function must be protected by channel_map.rdlock(). dec_reference has to be called in conjunction with inc_reference().

◆ increment_failover_list_position()

void Master_info::increment_failover_list_position ( )
inline

Increment current position, so next failover source can be selected on failure.

◆ init_master_log_pos()

void Master_info::init_master_log_pos ( )

◆ is_auto_position()

bool Master_info::is_auto_position ( )
inline

◆ is_configured()

static bool Master_info::is_configured ( Master_info mi)
inlinestatic

◆ is_gtid_only_mode()

bool Master_info::is_gtid_only_mode ( ) const

Returns if gtid_only is enabled or not.

Returns
true if gtid_only mode is active for a channel, false otherwise.

◆ is_ignore_server_ids_configured()

bool Master_info::is_ignore_server_ids_configured ( )

This member function shall return true if there are server ids configured to be ignored.

Returns
true if there are server ids to be ignored, false otherwise.

◆ is_metric_collection_enabled()

bool Master_info::is_metric_collection_enabled ( )
inline

Returns if metric collection is enabled on this channel.

Returns
True if yes, false if no

◆ is_network_error()

bool Master_info::is_network_error ( )
inline

Checks if network error has occurred.

Returns
true if slave IO thread failure was due to network error, false otherwise.

◆ is_queueing_trx()

bool Master_info::is_queueing_trx ( )
inline
Returns
True if there is a transaction currently being queued

◆ is_receiver_position_info_invalid()

bool Master_info::is_receiver_position_info_invalid ( ) const

Returns if receiver position information is valid or invalid.

Returns
true if receiver position information is not reliable, false otherwise.

◆ is_rotate_requested()

bool Master_info::is_rotate_requested ( )

Checks whether or not there is a request for rotating the underlying relay log.

Returns
true if there is, false otherwise

◆ is_set_network_namespace()

bool Master_info::is_set_network_namespace ( ) const
inline

◆ is_source_connection_auto_failover()

bool Master_info::is_source_connection_auto_failover ( )
inline

Checks if Asynchronous Replication Connection Failover feature is enabled.

Returns
true if Asynchronous Replication Connection Failover feature is enabled. false otherwise.

◆ is_start_plugin_auth_configured()

bool Master_info::is_start_plugin_auth_configured ( ) const
inline

Returns if DEFAULT_AUTH was specified when running START REPLICA.

Returns
true or false.

◆ is_start_plugin_dir_configured()

bool Master_info::is_start_plugin_dir_configured ( ) const
inline

Returns if PLUGIN_DIR was specified when running START REPLICA.

Returns
true or false.

◆ is_start_user_configured()

bool Master_info::is_start_user_configured ( ) const
inline

Returns if USER/PASSWORD was specified when running START REPLICA.

Returns
true or false.

◆ mi_init_info()

int Master_info::mi_init_info ( )

Creates or reads information from the repository, initializing the Master_info.

◆ network_namespace_str()

const char * Master_info::network_namespace_str ( ) const
inline

◆ operator=()

Master_info & Master_info::operator= ( const Master_info info)
private

◆ read_info()

bool Master_info::read_info ( Rpl_info_handler from)
overrideprivatevirtual

Implements Rpl_info.

◆ request_rotate()

void Master_info::request_rotate ( THD thd)

Sets the flag that indicates that a relay log rotation has been requested.

Parameters
[in]thdthe client thread carrying the command.

◆ reset_failover_list_position()

void Master_info::reset_failover_list_position ( )
inline

Reset current position to 0, when new failover source list is fetched.

◆ reset_network_error()

void Master_info::reset_network_error ( )
inline

Resets m_network_error to false.

◆ reset_start_info()

void Master_info::reset_start_info ( )

Cleans in-memory password defined by START REPLICA.

◆ set_applier_metric_collection_status()

void Master_info::set_applier_metric_collection_status ( bool  value)
inline

Enable or disable metric collection.

Parameters
valuetrue to enable, false to disable

◆ set_auto_position()

void Master_info::set_auto_position ( bool  auto_position_param)
inline

◆ set_gtid_only_mode()

void Master_info::set_gtid_only_mode ( bool  gtid_only_mode)

Enable or disable the gtid_only mode.

Parameters
gtid_only_modevalue to set gtid_only (enable/disable it)

◆ set_info_search_keys()

bool Master_info::set_info_search_keys ( Rpl_info_handler to)
overridevirtual

To search in the slave repositories, each slave info object (mi, rli or worker) should use a primary key.

This function sets the field values of the slave info objects with the search information, which is nothing but PK in mysql slave info tables. Ex: field_value[23]="channel_name" in the master info object.

Currently, used only for TABLE repository.

Implements Rpl_info.

◆ set_master_log_name()

void Master_info::set_master_log_name ( const char *  log_file_name)
inline

◆ set_master_log_pos()

void Master_info::set_master_log_pos ( ulonglong  log_pos)
inline

◆ set_mi_description_event()

void Master_info::set_mi_description_event ( Format_description_log_event fdle)
inline

◆ set_network_error()

void Master_info::set_network_error ( )
inline

Sets m_network_error to true.

Its used by async replication connection failover in case of slave IO thread failure to check if it was due to network failure.

◆ set_nullable_fields()

void Master_info::set_nullable_fields ( MY_BITMAP nullable_fields)
static

Sets bits for columns that are allowed to be NULL.

Parameters
nullable_fieldsthe bitmap to hold the nullable fields.

◆ set_password()

void Master_info::set_password ( const char *  password_arg)

Stores either user's password in the master.info repository when CHANGE MASTER is executed or user's password used in START REPLICA if PASSWORD is specified.

Parameters
password_argis user's password.

◆ set_plugin_auth()

void Master_info::set_plugin_auth ( const char *  src)
inline

Stores the DEFAULT_AUTH defined by START REPLICA.

◆ set_plugin_dir()

void Master_info::set_plugin_dir ( const char *  src)
inline

Stores the DEFAULT_AUTH defined by START REPLICA.

◆ set_receiver_position_info_invalid()

void Master_info::set_receiver_position_info_invalid ( bool  invalid)

Marks the receiver position information (master_log_name, master_log_pos) as being invalid or not.

Parameters
invalidThe value to set the status to invalid or valid

◆ set_relay_log_info()

void Master_info::set_relay_log_info ( Relay_log_info info)

◆ set_source_connection_auto_failover()

void Master_info::set_source_connection_auto_failover ( )
inline

Enable Asynchronous Replication Connection Failover feature.

◆ set_start_user_configured()

void Master_info::set_start_user_configured ( bool  config)
inline

Defines that USER/PASSWORD was specified or not when running START REPLICA.

Parameters
configis true or false.

◆ set_user()

void Master_info::set_user ( const char *  user_arg)
inline

Sets either user's name in the master.info repository when CHANGE MASTER is executed or user's name used in START REPLICA if USER is specified.

Parameters
user_argis user's name.

◆ shall_ignore_server_id()

bool Master_info::shall_ignore_server_id ( ulong  s_id)

Reports if the s_id server has been configured to ignore events it generates with.

CHANGE REPLICATION SOURCE IGNORE_SERVER_IDS= ( list of server ids )

Method is called from the io thread event receiver filtering.

Parameters
s_idthe master server identifier
Return values
trueif s_id is in the list of ignored master servers,
falseotherwise.

◆ started_queueing()

void Master_info::started_queueing ( Gtid  gtid_arg,
ulonglong  original_ts_arg,
ulonglong  immediate_ts_arg 
)
inline

Stores the details of the transaction the receiver thread has just started queueing.

Parameters
gtid_argthe gtid of the trx
original_ts_argthe original commit timestamp of the transaction
immediate_ts_argthe immediate commit timestamp of the transaction

◆ unset_source_connection_auto_failover()

void Master_info::unset_source_connection_auto_failover ( )
inline

Disable Asynchronous Replication Connection Failover feature.

◆ update_flushed_relay_log_info()

void Master_info::update_flushed_relay_log_info ( )

Sync flushed_relay_log_info with current relay log coordinates.

It will sync the receiver thread relay log coordinates (file name and position) with the last master coordinates that were flushed into the Master_info repository.

This function shall be called by Master_info::flush_info() at the end of a successful flush of the Master_info content into the repository while still holding the data_lock.

It is also called my load_mi_and_rli_from_repositories(), right after the successful call to rli_init_info() that opens the relay log.

◆ wait_until_no_reference()

void Master_info::wait_until_no_reference ( THD thd)

It mush be called before deleting a channel and protected by channel_map_lock.wrlock().

Parameters
thdthe THD object of current thread

◆ write_info()

bool Master_info::write_info ( Rpl_info_handler to)
overrideprivatevirtual

Implements Rpl_info.

Friends And Related Function Documentation

◆ Rpl_info_factory

friend class Rpl_info_factory
friend

Member Data Documentation

◆ atomic_references

std::atomic<int32> Master_info::atomic_references {0}
private

◆ auto_position

bool Master_info::auto_position {false}
private

◆ bind_addr

char Master_info::bind_addr[HOSTNAME_LENGTH+1]

◆ checksum_alg_before_fd

mysql::binlog::event::enum_binlog_checksum_alg Master_info::checksum_alg_before_fd

◆ clock_diff_with_master

long Master_info::clock_diff_with_master

◆ compression_algorithm

char Master_info::compression_algorithm[COMPRESSION_ALGORITHM_NAME_BUFFER_SIZE]

◆ connect_retry

uint Master_info::connect_retry

◆ file_id

uint32 Master_info::file_id

◆ first_source_log_name

constexpr auto Master_info::first_source_log_name = "<First log>"
staticconstexpr

In case we start replication from the first binary log file and source log name is empty, we use first_source_log_name instead of 'master_log_name' in the error log.

◆ flushed_relay_log_info

Log_info Master_info::flushed_relay_log_info
private

◆ for_channel_str

char Master_info::for_channel_str[CHANNEL_NAME_LENGTH+31]

◆ for_channel_uppercase_str

char Master_info::for_channel_uppercase_str[CHANNEL_NAME_LENGTH+31]

◆ get_public_key

bool Master_info::get_public_key

◆ gtid_monitoring_info

Gtid_monitoring_info* Master_info::gtid_monitoring_info
private

Information on the current and last queued transactions.

◆ heartbeat_period

float Master_info::heartbeat_period

◆ host

char Master_info::host[HOSTNAME_LENGTH+1]

Host name or ip address stored in the master.info.

◆ ignore_server_ids

Server_ids* Master_info::ignore_server_ids

◆ key_info_rotate_cond

PSI_mutex_key* Master_info::key_info_rotate_cond
private

PSI key for the rotate_cond

◆ key_info_rotate_lock

PSI_mutex_key* Master_info::key_info_rotate_lock
private

PSI key for the rotate_lock

◆ last_heartbeat

ulonglong Master_info::last_heartbeat

◆ m_channel_lock

Checkable_rwlock* Master_info::m_channel_lock
private

◆ m_failover_list_position

uint Master_info::m_failover_list_position {0}
private

◆ m_gtid_only_mode

bool Master_info::m_gtid_only_mode
private

Is the replica working in GTID only mode, meaning it does not persist position related information when executing or queueing transactions.

◆ m_is_metric_collection_enabled

bool Master_info::m_is_metric_collection_enabled {false}
private

Is the collection of metrics enabled?

◆ m_is_receiver_position_info_invalid

bool Master_info::m_is_receiver_position_info_invalid
private

Are positions invalid.

When true this means the values for receiver position related information might be outdated.

◆ m_network_error

bool Master_info::m_network_error {false}
private

◆ m_queueing_transaction_gtid_event_size

int64_t Master_info::m_queueing_transaction_gtid_event_size {0}

The size of the gtid event for the transaction that is currently in progress of being queued.

This is private to the receiver.

◆ m_queueing_transaction_size

int64_t Master_info::m_queueing_transaction_size {0}

The decompressed size of the transaction that is currently in progress of being queued, if any.

This is private to the reciever.

◆ m_source_connection_auto_failover

bool Master_info::m_source_connection_auto_failover {false}
private

◆ m_uuid_from_host

std::string Master_info::m_uuid_from_host {}

◆ m_uuid_from_port

uint Master_info::m_uuid_from_port {0}

◆ master_id

ulong Master_info::master_id

◆ master_log_name

char Master_info::master_log_name[FN_REFLEN] {}
protected

◆ master_log_pos

my_off_t Master_info::master_log_pos
protected

◆ master_uuid

char Master_info::master_uuid[UUID_LENGTH+1]

◆ mi_description_event

Format_description_log_event* Master_info::mi_description_event
private

Format_description_log_event for events received from the master by the IO thread and written to the tail of the relay log.

Use patterns:

  • Created when the IO thread starts and destroyed when the IO thread stops.
  • Updated when the IO thread receives a Format_description_log_event.
  • Accessed by the IO thread when it de-serializes events (e.g., rotate events, Gtid events).
  • Written by the IO thread to the new relay log on every rotation.
  • Written by a client that executes FLUSH LOGS to the new relay log on every rotation.

Locks: All access is protected by Relay_log::LOCK_log.

◆ mysql

MYSQL* Master_info::mysql

◆ network_namespace

char Master_info::network_namespace[NAME_LEN]

◆ password

char Master_info::password[MAX_PASSWORD_LENGTH+1]
private

User's password stored in the master.info.

◆ port

uint Master_info::port

◆ public_key_path

char Master_info::public_key_path[FN_REFLEN]

◆ received_heartbeats

ulonglong Master_info::received_heartbeats

◆ reset

bool Master_info::reset

◆ retry_count

ulong Master_info::retry_count

◆ rli

Relay_log_info* Master_info::rli

◆ rotate_cond

mysql_cond_t Master_info::rotate_cond
private

Waiting condition that will block the process/thread requesting a relay log rotation in the middle of a transaction.

The process/thread will wait until the transaction is written to the relay log and the rotation is, successfully accomplished.

◆ rotate_lock

mysql_mutex_t Master_info::rotate_lock
private

Lock to protect from rotating the relay log when in the middle of a transaction.

◆ rotate_requested

std::atomic<bool> Master_info::rotate_requested {false}
private

If a rotate was requested while the relay log was in a transaction.

◆ server_extn

NET_SERVER Master_info::server_extn

◆ ssl

bool Master_info::ssl

◆ ssl_ca

char Master_info::ssl_ca[FN_REFLEN]

◆ ssl_capath

char Master_info::ssl_capath[FN_REFLEN]

◆ ssl_cert

char Master_info::ssl_cert[FN_REFLEN]

◆ ssl_cipher

char Master_info::ssl_cipher[FN_REFLEN]

◆ ssl_crl

char Master_info::ssl_crl[FN_REFLEN]

◆ ssl_crlpath

char Master_info::ssl_crlpath[FN_REFLEN]

◆ ssl_key

char Master_info::ssl_key[FN_REFLEN]

◆ ssl_verify_server_cert

bool Master_info::ssl_verify_server_cert

◆ start_password

char Master_info::start_password[MAX_PASSWORD_LENGTH+1]
private

Password specified when running START REPLICA.

◆ start_plugin_auth

char Master_info::start_plugin_auth[FN_REFLEN+1]
private

Stores the authentication plugin specified when running START REPLICA.

◆ start_plugin_dir

char Master_info::start_plugin_dir[FN_REFLEN+1]
private

Stores the authentication plugin directory specified when running START REPLICA.

◆ start_user

char Master_info::start_user[USERNAME_LENGTH+1]
private

User specified when running START REPLICA.

◆ start_user_configured

bool Master_info::start_user_configured
private

If true, USER/PASSWORD was specified when running START REPLICA.

◆ tls_ciphersuites

std::pair<bool, std::string> Master_info::tls_ciphersuites = {true, ""}

◆ tls_version

char Master_info::tls_version[FN_REFLEN]

◆ transaction_parser

Replication_transaction_boundary_parser Master_info::transaction_parser

◆ user

char Master_info::user[USERNAME_LENGTH+1]
private

User's name stored in the master.info.

◆ zstd_compression_level

int Master_info::zstd_compression_level

The documentation for this class was generated from the following files: