53#define DEFAULT_CONNECT_RETRY 60
145#ifdef HAVE_PSI_INTERFACE
215 }
else if (user_arg) {
254 bool get_password(
char *password_arg,
size_t *password_arg_size);
416 applier_metrics.inc_transactions_received_count(1);
672 uint param_id,
const char *param_channel);
Contains the classes representing events occurring in the replication stream.
This has the functionality of mysql_rwlock_t, with two differences:
Definition: rpl_gtid.h:325
void assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_gtid.h:572
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_gtid.h:506
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_gtid.h:576
Stores information to monitor a transaction during the different replication stages.
Definition: rpl_gtid.h:1413
const Gtid * get_processing_trx_gtid()
Returns the GTID of the processing_trx.
Definition: rpl_gtid_misc.cc:602
void clear()
Clear all monitoring information.
Definition: rpl_gtid_misc.cc:496
void finish()
Sets the final information, copy processing info to last_processed and clears processing info.
Definition: rpl_gtid_misc.cc:563
void start(Gtid gtid_arg, ulonglong original_ts_arg, ulonglong immediate_ts_arg, bool skipped_arg=false)
Sets the initial monitoring information.
Definition: rpl_gtid_misc.cc:523
bool is_processing_trx_set()
Returns true if the processing_trx is set, false otherwise.
Definition: rpl_gtid_misc.cc:593
void clear_processing_trx()
Clear only the processing_trx monitoring info.
Definition: rpl_gtid_misc.cc:503
mysql_mutex_t * get_log_lock()
Definition: binlog.h:889
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.
Definition: rpl_mi.cc:447
Gtid_monitoring_info * gtid_monitoring_info
Information on the current and last queued transactions.
Definition: rpl_mi.h:143
size_t get_user_size() const
Returns user's size name.
Definition: rpl_mi.h:224
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 ...
Definition: rpl_mi.cc:721
bool start_user_configured
If true, USER/PASSWORD was specified when running START REPLICA.
Definition: rpl_mi.h:115
char network_namespace[NAME_LEN]
Definition: rpl_mi.h:348
bool m_gtid_only_mode
Is the replica working in GTID only mode, meaning it does not persist position related information wh...
Definition: rpl_mi.h:835
bool is_rotate_requested()
Checks whether or not there is a request for rotating the underlying relay log.
Definition: rpl_mi.cc:306
Relay_log_info * rli
Definition: rpl_mi.h:304
void end_info()
Definition: rpl_mi.cc:337
bool is_gtid_only_mode() const
Returns if gtid_only is enabled or not.
Definition: rpl_mi.cc:816
void set_master_log_pos(ulonglong log_pos)
Definition: rpl_mi.h:494
char public_key_path[FN_REFLEN]
Definition: rpl_mi.h:298
char start_plugin_auth[FN_REFLEN+1]
Stores the authentication plugin specified when running START REPLICA.
Definition: rpl_mi.h:135
int mi_init_info()
Creates or reads information from the repository, initializing the Master_info.
Definition: rpl_mi.cc:407
void inc_reference()
Increase the reference count to prohibit deleting a channel.
Definition: rpl_mi.h:747
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 co...
Definition: rpl_mi.cc:798
void increment_failover_list_position()
Increment current position, so next failover source can be selected on failure.
Definition: rpl_mi.h:578
long clock_diff_with_master
Definition: rpl_mi.h:317
char master_uuid[UUID_LENGTH+1]
Definition: rpl_mi.h:341
mysql::binlog::event::enum_binlog_checksum_alg checksum_alg_before_fd
Definition: rpl_mi.h:339
char start_password[MAX_PASSWORD_LENGTH+1]
Password specified when running START REPLICA.
Definition: rpl_mi.h:131
void set_plugin_auth(const char *src)
Stores the DEFAULT_AUTH defined by START REPLICA.
Definition: rpl_mi.h:274
void set_receiver_position_info_invalid(bool invalid)
Marks the receiver position information (master_log_name, master_log_pos) as being invalid or not.
Definition: rpl_mi.cc:804
Gtid_monitoring_info * get_gtid_monitoring_info()
Definition: rpl_mi.h:380
void set_master_log_name(const char *log_file_name)
Definition: rpl_mi.h:491
static uint get_channel_field_num()
returns the column number of a channel in the TABLE repository.
Definition: rpl_mi.cc:442
void reset_network_error()
Resets m_network_error to false.
Definition: rpl_mi.h:598
const char * get_for_channel_str(bool upper_case=false) const override
Definition: rpl_mi.h:643
const char * get_user() const
If an user was specified when running START REPLICA, this function returns such user.
Definition: rpl_mi.h:233
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.
NET_SERVER server_extn
Definition: rpl_mi.h:361
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 ...
Definition: rpl_mi.cc:678
void set_source_connection_auto_failover()
Enable Asynchronous Replication Connection Failover feature.
Definition: rpl_mi.h:549
my_off_t master_log_pos
Definition: rpl_mi.h:478
Checkable_rwlock * m_channel_lock
Definition: rpl_mi.h:701
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 u...
Definition: rpl_mi.h:212
void request_rotate(THD *thd)
Sets the flag that indicates that a relay log rotation has been requested.
Definition: rpl_mi.cc:265
char compression_algorithm[COMPRESSION_ALGORITHM_NAME_BUFFER_SIZE]
Definition: rpl_mi.h:359
bool is_source_connection_auto_failover()
Checks if Asynchronous Replication Connection Failover feature is enabled.
Definition: rpl_mi.h:542
const char * get_start_plugin_dir()
Returns the PLUGIN_DIR defined by START REPLICA.
Definition: rpl_mi.h:270
bool is_set_network_namespace() const
Definition: rpl_mi.h:350
void reset_failover_list_position()
Reset current position to 0, when new failover source list is fetched.
Definition: rpl_mi.h:572
void clear_gtid_monitoring_info(bool need_lock=false)
Clears all GTID monitoring info.
Definition: rpl_mi.h:449
uint connect_retry
Definition: rpl_mi.h:306
bool is_network_error()
Checks if network error has occurred.
Definition: rpl_mi.h:586
char for_channel_uppercase_str[CHANNEL_NAME_LENGTH+31]
Definition: rpl_mi.h:375
bool auto_position
Definition: rpl_mi.h:654
void clear_rotate_requests()
Clears the flag that indicates that a relay log rotation has been requested and notifies requester th...
Definition: rpl_mi.cc:285
bool ssl
Definition: rpl_mi.h:284
void set_gtid_only_mode(bool gtid_only_mode)
Enable or disable the gtid_only mode.
Definition: rpl_mi.cc:812
uint m_failover_list_position
Definition: rpl_mi.h:656
Log_info flushed_relay_log_info
Definition: rpl_mi.h:828
void channel_rdlock()
Acquire the channel read lock.
Definition: rpl_mi.cc:757
char ssl_capath[FN_REFLEN]
Definition: rpl_mi.h:285
void reset_start_info()
Cleans in-memory password defined by START REPLICA.
Definition: rpl_mi.cc:748
std::pair< bool, std::string > tls_ciphersuites
Definition: rpl_mi.h:296
Replication_transaction_boundary_parser transaction_parser
Definition: rpl_mi.h:687
void set_applier_metric_collection_status(bool value)
Enable or disable metric collection.
Definition: rpl_mi.h:861
void set_auto_position(bool auto_position_param)
Definition: rpl_mi.h:531
static bool is_configured(Master_info *mi)
Definition: rpl_mi.h:109
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...
Definition: rpl_mi.cc:732
void set_mi_description_event(Format_description_log_event *fdle)
Definition: rpl_mi.h:635
static constexpr auto first_source_log_name
In case we start replication from the first binary log file and source log name is empty,...
Definition: rpl_mi.h:94
Format_description_log_event * get_mi_description_event()
Definition: rpl_mi.h:631
void dec_reference()
Decrease the reference count.
Definition: rpl_mi.h:753
char master_log_name[FN_REFLEN]
Definition: rpl_mi.h:477
bool is_ignore_server_ids_configured()
This member function shall return true if there are server ids configured to be ignored.
Definition: rpl_mi.cc:783
void channel_wrlock()
Acquire the channel write lock.
Definition: rpl_mi.cc:762
void update_flushed_relay_log_info()
Sync flushed_relay_log_info with current relay log coordinates.
Definition: rpl_mi.cc:787
ulonglong last_heartbeat
Definition: rpl_mi.h:322
bool read_info(Rpl_info_handler *from) override
Definition: rpl_mi.cc:459
bool ssl_verify_server_cert
Definition: rpl_mi.h:299
uint32 file_id
Definition: rpl_mi.h:303
int flush_info(bool force=false)
Store the master file and position where the slave's I/O thread are in the relay log.
Definition: rpl_mi.cc:366
bool m_network_error
Definition: rpl_mi.h:657
void wait_until_no_reference(THD *thd)
It mush be called before deleting a channel and protected by channel_map_lock.wrlock().
Definition: rpl_mi.cc:772
std::atomic< int32 > atomic_references
Definition: rpl_mi.h:704
static void set_nullable_fields(MY_BITMAP *nullable_fields)
Sets bits for columns that are allowed to be NULL.
Definition: rpl_mi.cc:451
bool reset
Definition: rpl_mi.h:764
void channel_unlock()
Release the channel lock (whether it is a write or read lock).
Definition: rpl_mi.h:726
PSI_mutex_key * key_info_rotate_cond
PSI key for the rotate_cond
Definition: rpl_mi.h:153
ulong master_id
Definition: rpl_mi.h:333
int64_t m_queueing_transaction_size
The decompressed size of the transaction that is currently in progress of being queued,...
Definition: rpl_mi.h:326
void set_relay_log_info(Relay_log_info *info)
Definition: rpl_mi.cc:401
std::string m_uuid_from_host
Definition: rpl_mi.h:847
char ssl_key[FN_REFLEN]
Definition: rpl_mi.h:286
bool m_is_receiver_position_info_invalid
Are positions invalid.
Definition: rpl_mi.h:841
const char * get_io_rpl_log_name()
Definition: rpl_mi.h:498
const Gtid * get_queueing_trx_gtid()
Definition: rpl_mi.h:431
PSI_mutex_key * key_info_rotate_lock
PSI key for the rotate_lock
Definition: rpl_mi.h:149
MYSQL * mysql
Definition: rpl_mi.h:302
ulonglong received_heartbeats
Definition: rpl_mi.h:320
char host[HOSTNAME_LENGTH+1]
Host name or ip address stored in the master.info.
Definition: rpl_mi.h:99
char user[USERNAME_LENGTH+1]
User's name stored in the master.info.
Definition: rpl_mi.h:119
const char * get_master_log_name_info() const
Definition: rpl_mi.h:482
char ssl_crl[FN_REFLEN]
Definition: rpl_mi.h:297
char ssl_cipher[FN_REFLEN]
Definition: rpl_mi.h:286
char ssl_ca[FN_REFLEN]
Definition: rpl_mi.h:285
bool is_start_plugin_auth_configured() const
Returns if DEFAULT_AUTH was specified when running START REPLICA.
Definition: rpl_mi.h:185
uint get_failover_list_position()
Return current position in the Failover source list for the Asynchronous Replication Connection Failo...
Definition: rpl_mi.h:567
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)
Definition: rpl_mi.cc:160
void channel_assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_mi.h:738
char tls_version[FN_REFLEN]
Definition: rpl_mi.h:287
char bind_addr[HOSTNAME_LENGTH+1]
Definition: rpl_mi.h:342
mysql_cond_t rotate_cond
Waiting condition that will block the process/thread requesting a relay log rotation in the middle of...
Definition: rpl_mi.h:166
void set_start_user_configured(bool config)
Defines that USER/PASSWORD was specified or not when running START REPLICA.
Definition: rpl_mi.h:202
ulonglong get_master_log_pos() const
Definition: rpl_mi.h:486
Server_ids * ignore_server_ids
Definition: rpl_mi.h:331
bool is_auto_position()
Definition: rpl_mi.h:529
bool is_start_user_configured() const
Returns if USER/PASSWORD was specified when running START REPLICA.
Definition: rpl_mi.h:179
char for_channel_str[CHANNEL_NAME_LENGTH+31]
Definition: rpl_mi.h:374
uint m_uuid_from_port
Definition: rpl_mi.h:852
~Master_info() override
Definition: rpl_mi.cc:248
char ssl_crlpath[FN_REFLEN]
Definition: rpl_mi.h:297
char start_user[USERNAME_LENGTH+1]
User specified when running START REPLICA.
Definition: rpl_mi.h:127
int64_t m_queueing_transaction_gtid_event_size
The size of the gtid event for the transaction that is currently in progress of being queued.
Definition: rpl_mi.h:329
bool is_receiver_position_info_invalid() const
Returns if receiver position information is valid or invalid.
Definition: rpl_mi.cc:808
bool shall_ignore_server_id(ulong s_id)
Reports if the s_id server has been configured to ignore events it generates with.
Definition: rpl_mi.cc:323
const char * network_namespace_str() const
Definition: rpl_mi.h:352
void channel_assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_mi.h:731
ulong retry_count
Definition: rpl_mi.h:340
bool write_info(Rpl_info_handler *to) override
Definition: rpl_mi.cc:686
void clear_queueing_trx(bool need_lock=false)
Clears the processing_trx monitoring info.
Definition: rpl_mi.h:440
void set_network_error()
Sets m_network_error to true.
Definition: rpl_mi.h:593
void finished_queueing()
Track statistics after the receiver has finished queueing a transaction.
Definition: rpl_mi.h:405
char start_plugin_dir[FN_REFLEN+1]
Stores the authentication plugin directory specified when running START REPLICA.
Definition: rpl_mi.h:140
int zstd_compression_level
Definition: rpl_mi.h:360
Master_info(const Master_info &info)
char ssl_cert[FN_REFLEN]
Definition: rpl_mi.h:285
std::atomic< bool > rotate_requested
If a rotate was requested while the relay log was in a transaction.
Definition: rpl_mi.h:170
mysql_mutex_t rotate_lock
Lock to protect from rotating the relay log when in the middle of a transaction.
Definition: rpl_mi.h:159
bool m_source_connection_auto_failover
Definition: rpl_mi.h:655
bool get_public_key
Definition: rpl_mi.h:300
ulonglong get_master_log_pos_info() const
Definition: rpl_mi.h:487
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.
Definition: rpl_mi.h:392
float heartbeat_period
Definition: rpl_mi.h:318
static size_t get_number_info_mi_fields()
Definition: rpl_mi.cc:438
Master_info & operator=(const Master_info &info)
uint port
Definition: rpl_mi.h:305
bool is_metric_collection_enabled()
Returns if metric collection is enabled on this channel.
Definition: rpl_mi.h:867
bool is_queueing_trx()
Definition: rpl_mi.h:423
int channel_trywrlock()
Try to acquire the write lock, and fail if it cannot be immediately granted.
Definition: rpl_mi.cc:767
const char * get_master_log_name() const
Definition: rpl_mi.h:481
bool m_is_metric_collection_enabled
Is the collection of metrics enabled?
Definition: rpl_mi.h:856
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 ...
Definition: rpl_mi.h:628
bool is_start_plugin_dir_configured() const
Returns if PLUGIN_DIR was specified when running START REPLICA.
Definition: rpl_mi.h:193
void init_master_log_pos()
Definition: rpl_mi.cc:328
void set_plugin_dir(const char *src)
Stores the DEFAULT_AUTH defined by START REPLICA.
Definition: rpl_mi.h:280
char password[MAX_PASSWORD_LENGTH+1]
User's password stored in the master.info.
Definition: rpl_mi.h:123
void unset_source_connection_auto_failover()
Disable Asynchronous Replication Connection Failover feature.
Definition: rpl_mi.h:556
const char * get_start_plugin_auth()
Returns the DEFAULT_AUTH defined by START REPLICA.
Definition: rpl_mi.h:264
Definition: rpl_rli.h:206
cs::apply::instruments::Applier_metrics_interface & get_applier_metrics()
Returns the replication applier metrics aggregator.
Definition: rpl_rli.cc:3319
MYSQL_BIN_LOG relay_log
Definition: rpl_rli.h:335
This is the class for verifying transaction boundaries in a replication event stream.
Definition: rpl_trx_boundary_parser.h:51
Definition: rpl_info_factory.h:41
Definition: rpl_info_handler.h:58
Definition: rpl_info.h:43
mysql_mutex_t data_lock
Definition: rpl_info.h:58
Definition: dynamic_ids.h:33
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
virtual void inc_transactions_received_size_sum(int64_t amount)=0
increment the pending size of queued transactions.
virtual bool is_after_metrics_breakpoint() const =0
Query whether the size/count of received transactions has been completely computed.
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
#define COMPRESSION_ALGORITHM_NAME_BUFFER_SIZE
Definition: compression.h:42
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
#define mysql_mutex_assert_owner(M)
Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
Definition: mysql_mutex.h:112
std::string log_file_name(const Log_files_context &ctx, Log_file_id file_id)
Provides name of the log file with the given file id, e.g.
Definition: log0files_io.cc:716
Binary log event definitions.
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:43
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
ulonglong my_off_t
Definition: my_inttypes.h:72
uint32_t uint32
Definition: my_inttypes.h:67
Common #defines and includes for file and socket I/O.
#define FN_REFLEN
Definition: my_io.h:83
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
#define HAVE_PSI_INTERFACE
Definition: my_psi_config.h:39
Common definition between mysql server & client.
#define NAME_LEN
Definition: mysql_com.h:67
#define USERNAME_LENGTH
Definition: mysql_com.h:69
enum_binlog_checksum_alg
Enumeration spcifying checksum algorithm used to encode a binary log event.
Definition: binlog_event.h:454
Instrumentation helpers for mutexes.
Instrumentation helpers for mutexes.
#define CHANNEL_NAME_LENGTH
Definition: rpl_info.h:41
Replication transaction boundary parser.
File containing constants that can be used throughout the server.
constexpr const size_t UUID_LENGTH
Definition: sql_const.h:266
char * strmake(char *dst, const char *src, size_t length)
Definition: strmake.cc:42
TODO: Move this structure to mysql/binlog/event/control_events.h when we start using C++11.
Definition: rpl_gtid.h:1101
Definition: binlog_index.h:86
Definition: my_bitmap.h:43
Definition: mysql_com_server.h:59
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Include file for Sun RPC to compile out of the box.
#define MAX_PASSWORD_LENGTH
Definition: validate_password.cc:66