MySQL 8.4.3
Source Code Documentation
|
#include <rpl_mi.h>
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_info * | get_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 () |
When the receiver thread finishes queueing a transaction, that timestamp is recorded and the information is copied to last_queued_trx and cleared from queueing_trx. More... | |
bool | is_queueing_trx () |
const Gtid * | get_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_event * | get_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... | |
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_handler * | get_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... | |
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_handler * | handler |
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_info & | operator= (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_info * | gtid_monitoring_info |
Information on the current and last queued transactions. More... | |
PSI_mutex_key * | key_info_rotate_lock |
PSI key for the rotate_lock More... | |
PSI_mutex_key * | key_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_event * | mi_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_rwlock * | m_channel_lock |
std::atomic< int32 > | atomic_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... | |
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 |
|
override |
|
private |
|
private |
|
inline |
Assert that some thread holds either the read or the write lock.
|
inline |
Assert that some thread holds the write lock.
void Master_info::channel_rdlock | ( | ) |
Acquire the channel read lock.
int Master_info::channel_trywrlock | ( | ) |
Try to acquire the write lock, and fail if it cannot be immediately granted.
|
inline |
Release the channel lock (whether it is a write or read lock).
void Master_info::channel_wrlock | ( | ) |
Acquire the channel write lock.
|
inline |
Clears all GTID monitoring info.
|
inline |
Clears the processing_trx monitoring info.
Normally called when there is an error while queueing the transaction.
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.
|
inline |
Decrease the reference count.
Doesn't need the protection of channel_map.rdlock.
void Master_info::end_info | ( | ) |
|
inline |
When the receiver thread finishes queueing a transaction, that timestamp is recorded and the information is copied to last_queued_trx and cleared from queueing_trx.
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.
force | when true, do not respect sync period and flush information. when false, flush will only happen if it is time to flush. |
|
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
|
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.
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.
[out] | linfo | Where the relay log coordinates shall be stored. |
|
inlineoverridevirtual |
Implements Slave_reporting_capability.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
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.
[out] | password_arg | is user's password. |
[out] | password_arg_size | is user's password size. |
|
inline |
|
inline |
Returns the DEFAULT_AUTH defined by START REPLICA.
|
inline |
Returns the PLUGIN_DIR defined by START REPLICA.
|
static |
Returns an array with the expected column numbers of the primary key fields of the table repository.
|
static |
Returns an array with the expected column names of the primary key fields of the table repository.
|
inline |
If an user was specified when running START REPLICA, this function returns such user.
Otherwise, it returns the user stored in master.info.
|
inline |
Returns user's size name.
See get_user()
.
|
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().
|
inline |
Increment current position, so next failover source can be selected on failure.
void Master_info::init_master_log_pos | ( | ) |
|
inline |
|
inlinestatic |
bool Master_info::is_gtid_only_mode | ( | ) | const |
Returns if gtid_only is enabled or not.
bool Master_info::is_ignore_server_ids_configured | ( | ) |
This member function shall return true if there are server ids configured to be ignored.
|
inline |
Checks if network error has occurred.
|
inline |
bool Master_info::is_receiver_position_info_invalid | ( | ) | const |
Returns if receiver position information is valid or invalid.
bool Master_info::is_rotate_requested | ( | ) |
Checks whether or not there is a request for rotating the underlying relay log.
|
inline |
|
inline |
Checks if Asynchronous Replication Connection Failover feature is enabled.
|
inline |
Returns if DEFAULT_AUTH was specified when running START REPLICA.
|
inline |
Returns if PLUGIN_DIR was specified when running START REPLICA.
|
inline |
Returns if USER/PASSWORD was specified when running START REPLICA.
int Master_info::mi_init_info | ( | ) |
Creates or reads information from the repository, initializing the Master_info.
|
inline |
|
private |
|
overrideprivatevirtual |
Implements Rpl_info.
void Master_info::request_rotate | ( | THD * | thd | ) |
Sets the flag that indicates that a relay log rotation has been requested.
[in] | thd | the client thread carrying the command. |
|
inline |
Reset current position to 0, when new failover source list is fetched.
|
inline |
Resets m_network_error to false.
void Master_info::reset_start_info | ( | ) |
Cleans in-memory password defined by START REPLICA.
|
inline |
void Master_info::set_gtid_only_mode | ( | bool | gtid_only_mode | ) |
Enable or disable the gtid_only mode.
gtid_only_mode | value to set gtid_only (enable/disable it) |
|
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.
|
inline |
|
inline |
|
inline |
|
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.
|
static |
Sets bits for columns that are allowed to be NULL
.
nullable_fields | the bitmap to hold the nullable fields. |
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.
password_arg | is user's password. |
|
inline |
Stores the DEFAULT_AUTH defined by START REPLICA.
|
inline |
Stores the DEFAULT_AUTH defined by START REPLICA.
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.
invalid | The value to set the status to invalid or valid |
void Master_info::set_relay_log_info | ( | Relay_log_info * | info | ) |
|
inline |
Enable Asynchronous Replication Connection Failover feature.
|
inline |
Defines that USER/PASSWORD was specified or not when running START REPLICA.
config | is true or false. |
|
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.
user_arg | is user's name. |
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.
s_id | the master server identifier |
true | if s_id is in the list of ignored master servers, |
false | otherwise. |
|
inline |
Stores the details of the transaction the receiver thread has just started queueing.
gtid_arg | the gtid of the trx |
original_ts_arg | the original commit timestamp of the transaction |
immediate_ts_arg | the immediate commit timestamp of the transaction |
|
inline |
Disable Asynchronous Replication Connection Failover feature.
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.
void Master_info::wait_until_no_reference | ( | THD * | thd | ) |
It mush be called before deleting a channel and protected by channel_map_lock.wrlock().
thd | the THD object of current thread |
|
overrideprivatevirtual |
Implements Rpl_info.
|
friend |
|
private |
|
private |
char Master_info::bind_addr[HOSTNAME_LENGTH+1] |
mysql::binlog::event::enum_binlog_checksum_alg Master_info::checksum_alg_before_fd |
long Master_info::clock_diff_with_master |
char Master_info::compression_algorithm[COMPRESSION_ALGORITHM_NAME_BUFFER_SIZE] |
uint Master_info::connect_retry |
uint32 Master_info::file_id |
|
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.
|
private |
char Master_info::for_channel_str[CHANNEL_NAME_LENGTH+31] |
char Master_info::for_channel_uppercase_str[CHANNEL_NAME_LENGTH+31] |
bool Master_info::get_public_key |
|
private |
Information on the current and last queued transactions.
float Master_info::heartbeat_period |
char Master_info::host[HOSTNAME_LENGTH+1] |
Host name or ip address stored in the master.info.
Server_ids* Master_info::ignore_server_ids |
|
private |
PSI key for the rotate_cond
|
private |
PSI key for the rotate_lock
ulonglong Master_info::last_heartbeat |
|
private |
|
private |
|
private |
Is the replica working in GTID only mode, meaning it does not persist position related information when executing or queueing transactions.
|
private |
Are positions invalid.
When true this means the values for receiver position related information might be outdated.
|
private |
|
private |
std::string Master_info::m_uuid_from_host {} |
uint Master_info::m_uuid_from_port {0} |
ulong Master_info::master_id |
|
protected |
|
protected |
char Master_info::master_uuid[UUID_LENGTH+1] |
|
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:
Locks: All access is protected by Relay_log::LOCK_log.
MYSQL* Master_info::mysql |
char Master_info::network_namespace[NAME_LEN] |
|
private |
User's password stored in the master.info.
uint Master_info::port |
char Master_info::public_key_path[FN_REFLEN] |
ulonglong Master_info::received_heartbeats |
bool Master_info::reset |
ulong Master_info::retry_count |
Relay_log_info* Master_info::rli |
|
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.
|
private |
Lock to protect from rotating the relay log when in the middle of a transaction.
|
private |
If a rotate was requested while the relay log was in a transaction.
NET_SERVER Master_info::server_extn |
bool Master_info::ssl |
char Master_info::ssl_ca[FN_REFLEN] |
char Master_info::ssl_capath[FN_REFLEN] |
char Master_info::ssl_cert[FN_REFLEN] |
char Master_info::ssl_cipher[FN_REFLEN] |
char Master_info::ssl_crl[FN_REFLEN] |
char Master_info::ssl_crlpath[FN_REFLEN] |
char Master_info::ssl_key[FN_REFLEN] |
bool Master_info::ssl_verify_server_cert |
|
private |
Password specified when running START REPLICA.
|
private |
Stores the authentication plugin specified when running START REPLICA.
|
private |
Stores the authentication plugin directory specified when running START REPLICA.
|
private |
User specified when running START REPLICA.
|
private |
If true, USER/PASSWORD was specified when running START REPLICA.
std::pair<bool, std::string> Master_info::tls_ciphersuites = {true, ""} |
char Master_info::tls_version[FN_REFLEN] |
Replication_transaction_boundary_parser Master_info::transaction_parser |
|
private |
User's name stored in the master.info.
int Master_info::zstd_compression_level |