MySQL 8.4.2
Source Code Documentation
|
#include <rpl_rli.h>
Public Member Functions | |
bool | belongs_to_client () |
Gtid_monitoring_info * | get_gtid_monitoring_info () |
void | started_processing (Gtid gtid_arg, ulonglong original_ts_arg, ulonglong immediate_ts_arg, bool skipped=false) |
Stores the details of the transaction which has just started processing. More... | |
void | started_processing (Gtid_log_event *gtid_log_ev_arg) |
Stores the details of the transaction which has just started processing. More... | |
void | finished_processing () |
When the processing of a transaction is completed, that timestamp is recorded, the information is copied to last_processed_trx and the information in processing_trx is cleared. More... | |
bool | is_processing_trx () |
void | clear_processing_trx () |
Clears the processing_trx structure fields. More... | |
void | clear_gtid_monitoring_info () |
Clears the Gtid_monitoring_info fields. More... | |
void | retried_processing (uint transient_errno_arg, const char *transient_err_message_arg, ulong trans_retries_arg) |
When a transaction is retried, the error number and message, and total number of retries are stored. More... | |
std::string | get_privilege_checks_username () const |
Retrieves the username part of the PRIVILEGE_CHECKS_USER option of CHANGE MASTER TO statement. More... | |
std::string | get_privilege_checks_hostname () const |
Retrieves the host part of the PRIVILEGE_CHECKS_USER option of CHANGE MASTER TO statement. More... | |
bool | is_privilege_checks_user_null () const |
Returns whether or not there is no user configured for PRIVILEGE_CHECKS_USER . More... | |
bool | is_privilege_checks_user_corrupted () const |
Returns whether or not the internal data regarding PRIVILEGE_CHECKS_USER is corrupted. More... | |
void | clear_privilege_checks_user () |
Clears the info related to the data initialized from PRIVILEGE_CHECKS_USER . More... | |
void | set_privilege_checks_user_corrupted (bool is_corrupted) |
Sets the flag that tells whether or not the data regarding the PRIVILEGE_CHECKS_USER is corrupted. More... | |
enum_priv_checks_status | set_privilege_checks_user (char const *param_privilege_checks_username, char const *param_privilege_checks_hostname) |
Initializes data related to PRIVILEGE_CHECKS_USER , specifically the user name and the user hostname. More... | |
enum_priv_checks_status | check_privilege_checks_user () |
Checks the validity and integrity of the data related to PRIVILEGE_CHECKS_USER , specifically the user name and the user hostname. More... | |
enum_priv_checks_status | check_privilege_checks_user (char const *param_privilege_checks_username, char const *param_privilege_checks_hostname) |
Checks the validity and integrity of the data related to PRIVILEGE_CHECKS_USER , specifically the user name and the user hostname. More... | |
enum_priv_checks_status | check_applier_acl_user (char const *param_privilege_checks_username, char const *param_privilege_checks_hostname) |
Checks the existence of user provided as part of the PRIVILEGE_CHECKS_USER option. More... | |
std::pair< const char *, const char * > | print_applier_security_context_user_host () const |
Returns a printable representation of the username and hostname currently being used in the applier security context or empty strings other wise. More... | |
void | report_privilege_check_error (enum loglevel level, enum_priv_checks_status status_code, bool to_client, char const *channel_name=nullptr, char const *user_name=nullptr, char const *host_name=nullptr) const |
Outputs the error message associated with applier thread user privilege checks error error_code . More... | |
enum_priv_checks_status | initialize_security_context (THD *thd) |
Initializes the security context associated with the PRIVILEGE_CHECKS_USER user that is to be used by the provided THD object. More... | |
enum_priv_checks_status | initialize_applier_security_context () |
Initializes the security context associated with the PRIVILEGE_CHECKS_USER user that is to be used by the applier thread. More... | |
bool | is_row_format_required () const |
Returns whether the slave is running in row mode only. More... | |
void | set_require_row_format (bool require_row) |
Sets the flag that tells whether or not the slave is running in row mode only. More... | |
enum_require_table_primary_key | get_require_table_primary_key_check () const |
Returns what is the slave policy concerning primary keys on replicated tables. More... | |
void | set_require_table_primary_key_check (enum_require_table_primary_key require_pk) |
Sets the field that tells what is the slave policy concerning primary keys on replicated tables. More... | |
void | set_applier_source_position_info_invalid (bool invalid) |
Marks the applier position information as being invalid or not. More... | |
bool | is_applier_source_position_info_invalid () const |
Returns if the applier positions are marked as being invalid or not. More... | |
void | set_group_source_log_start_end_pos (const Log_event *ev) |
Process an event and based on its type () set group beginning and end. More... | |
std::tuple< ulonglong, ulonglong > | get_group_source_log_start_end_pos () const |
Get event group positions in source binary log on a replica which is processed by a worker in MTA or coordinator in STA. More... | |
bool | is_relay_log_truncated () |
Tsid_map * | get_tsid_map () |
Checkable_rwlock * | get_tsid_lock () |
void | add_logged_gtid (rpl_sidno sidno, rpl_gno gno) |
enum_return_status | add_gtid_set (const Gtid_set *gtid_set) |
Adds a GTID set to received GTID set. More... | |
const Gtid_set * | get_gtid_set () const |
bool | reinit_sql_thread_io_cache (const char *log, bool need_data_lock) |
bool | is_group_relay_log_name_invalid (const char **errmsg) |
Check if group_relay_log_name is in index file. More... | |
bool | reset_group_relay_log_pos (const char **errmsg) |
Reset group_relay_log_name and group_relay_log_pos to the start of the first relay log file. More... | |
void | fill_coord_err_buf (loglevel level, int err_code, const char *buff_coord) const |
Update the error number, message and timestamp fields. More... | |
void | clear_sql_delay () |
Reset the delay. More... | |
void | notify_relay_log_change () |
Invalidates cached until_log_name and event_relay_log_name comparison result. More... | |
void | notify_relay_log_truncated () |
Receiver thread notifies that it truncated some data from relay log. More... | |
void | clear_relay_log_truncated () |
Applier clears the flag after it handled the situation. More... | |
void | notify_group_master_log_name_update () |
The same as notify_group_relay_log_name_update but for group_master_log_name . More... | |
void | inc_event_relay_log_pos () |
int | inc_group_relay_log_pos (ulonglong log_pos, bool need_data_lock, bool force=false) |
Last executed event group coordinates are updated and optionally forcibly flushed to a repository. More... | |
int | wait_for_pos (THD *thd, String *log_name, longlong log_pos, double timeout) |
Waits until the SQL thread reaches (has executed up to) the log/position or timed out. More... | |
int | wait_for_gtid_set (THD *thd, const char *gtid, double timeout, bool update_THD_status=true) |
Wait for a GTID set to be executed. More... | |
int | wait_for_gtid_set (THD *thd, String *gtid, double timeout, bool update_THD_status=true) |
Wait for a GTID set to be executed. More... | |
int | wait_for_gtid_set (THD *thd, const Gtid_set *wait_gtid_set, double timeout, bool update_THD_status=true) |
Wait for a GTID set to be executed. More... | |
void | close_temporary_tables () |
bool | get_table_data (TABLE *table_arg, table_def **tabledef_var, TABLE **conv_table_var) const |
void | cached_charset_invalidate () |
Last charset (6 bytes) seen by slave SQL thread is cached here; it helps the thread save 3 get_charset() per Query_log_event if the charset is not changing from event to event (common situation). More... | |
bool | cached_charset_compare (char *charset) const |
void | cleanup_context (THD *, bool) |
void | slave_close_thread_tables (THD *) |
void | clear_tables_to_lock () |
int | purge_relay_logs (THD *thd, const char **errmsg, bool delete_only=false) |
Purges relay logs. More... | |
size_t | get_worker_count () |
Slave_worker * | get_worker (size_t n) |
virtual bool | commit_positions () |
The method implements updating a slave info table. More... | |
void | init_workers (ulong) |
The method to invoke at slave threads start. More... | |
void | deinit_workers () |
The method to invoke at slave threads stop. More... | |
bool | is_mts_recovery () const |
returns true if there is any gap-group of events to execute at slave starting phase. More... | |
void | clear_mts_recovery_groups () |
bool | is_parallel_exec () const |
returns true if events are to be executed in parallel More... | |
bool | is_mts_in_group () |
returns true if Coordinator is scheduling events belonging to the same group and has not reached yet its terminal event. More... | |
bool | is_time_for_mta_checkpoint () |
Check if it is time to compute MTS checkpoint. More... | |
void | reset_notified_relay_log_change () |
While a group is executed by a Worker the relay log can change. More... | |
void | reset_notified_checkpoint (ulong count, time_t new_ts, bool update_timestamp=false) |
While a group is executed by a Worker the relay log can change. More... | |
bool | mts_finalize_recovery () |
Called when gaps execution is ended so it is crash-safe to reset the last session Workers info. More... | |
void | cleanup_after_query () |
void | cleanup_after_session () |
int | stmt_done (my_off_t event_log_pos) |
Helper function to do after statement completion. More... | |
void | set_flag (enum_state_flag flag) |
Set the value of a replication state flag. More... | |
bool | get_flag (enum_state_flag flag) |
Get the value of a replication state flag. More... | |
void | clear_flag (enum_state_flag flag) |
Clear the value of a replication state flag. More... | |
bool | is_in_group () const |
A group is defined as the entire range of events that constitute a transaction or auto-committed statement. More... | |
int | count_relay_log_space () |
int | rli_init_info (bool skip_received_gtid_set_and_relaylog_recovery=false) |
Initialize the relay log info. More... | |
void | end_info () |
int | flush_info (const int flush_flags) |
Stores the file and position where the execute-slave thread are in the relay log: More... | |
bool | clear_info () |
Clears from this Relay_log_info object all attribute values that are not to be kept. More... | |
enum_return_check | check_if_info_was_cleared (const enum_return_check &previous_result) const |
Checks if the underlying Rpl_info handler holds information for the fields to be kept between slave resets, while the other fields were cleared. More... | |
int | flush_current_log () |
void | set_master_info (Master_info *info) |
ulonglong | get_future_event_relay_log_pos () |
void | set_future_event_relay_log_pos (ulonglong log_pos) |
const char * | get_group_master_log_name () const |
const char * | get_group_master_log_name_info () const |
ulonglong | get_group_master_log_pos () const |
ulonglong | get_group_master_log_pos_info () const |
void | set_group_master_log_name (const char *log_file_name) |
void | set_group_master_log_pos (ulonglong log_pos) |
const char * | get_group_relay_log_name () |
ulonglong | get_group_relay_log_pos () |
void | set_group_relay_log_name (const char *log_file_name) |
void | set_group_relay_log_name (const char *log_file_name, size_t len) |
void | set_group_relay_log_pos (ulonglong log_pos) |
const char * | get_event_relay_log_name () |
ulonglong | get_event_relay_log_pos () |
void | set_event_relay_log_name (const char *log_file_name) |
void | set_event_start_pos (my_off_t pos) |
my_off_t | get_event_start_pos () |
void | set_event_relay_log_pos (ulonglong log_pos) |
const char * | get_rpl_log_name () const |
void | start_sql_delay (time_t delay_end) |
Indicate that a delay starts. More... | |
time_t | get_sql_delay () |
void | set_sql_delay (time_t _sql_delay) |
time_t | get_sql_delay_end () |
Relay_log_info (bool is_slave_recovery, 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, bool is_rli_fake) | |
~Relay_log_info () override | |
time_t | get_row_stmt_start_timestamp () |
time_t | set_row_stmt_start_timestamp () |
void | reset_row_stmt_start_timestamp () |
void | set_long_find_row_note_printed () |
void | unset_long_find_row_note_printed () |
bool | is_long_find_row_note_printed () |
virtual int | set_rli_description_event (Format_description_log_event *fdle) |
Delete the existing event and set a new one. More... | |
Format_description_log_event * | get_rli_description_event () const |
Return the current Format_description_log_event. More... | |
ulong | adapt_to_master_version (Format_description_log_event *fdle) |
adaptation for the slave applier to specific master versions. More... | |
ulong | adapt_to_master_version_updown (ulong master_version, ulong current_version) |
The method compares two supplied versions and carries out down- or up- grade customization of execution context of the slave applier (thd). More... | |
Commit_order_manager * | get_commit_order_manager () |
void | set_commit_order_manager (Commit_order_manager *mngr) |
void | set_until_option (Until_option *option) |
void | clear_until_option () |
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... | |
virtual Relay_log_info * | get_c_rli () |
Get coordinator's RLI. More... | |
const char * | get_for_channel_str (bool upper_case=false) const override |
void | set_filter (Rpl_filter *channel_filter) |
Set replication filter for the channel. More... | |
void | set_thd_tx_priority (int priority) |
int | get_thd_tx_priority () |
void | set_ignore_write_set_memory_limit (bool ignore_limit) |
bool | get_ignore_write_set_memory_limit () |
void | set_allow_drop_write_set (bool does_not_require_ws) |
bool | get_allow_drop_write_set () |
const char * | get_until_log_name () |
my_off_t | get_until_log_pos () |
bool | is_until_satisfied_at_start_slave () |
bool | is_until_satisfied_before_dispatching_event (const Log_event *ev) |
bool | is_until_satisfied_after_dispatching_event () |
bool | is_until_satisfied_all_transactions_read_from_relay_log () |
int | init_until_option (THD *thd, const LEX_SOURCE_INFO *master_param) |
Initialize until option object when starting slave. More... | |
void | detach_engine_ha_data (THD *thd) |
Detaches the engine ha_data from THD. More... | |
void | reattach_engine_ha_data (THD *thd) |
Reattaches the engine ha_data to THD. More... | |
bool | is_engine_ha_data_detached () |
Checks whether engine ha data is detached from THD. More... | |
void | post_rollback () |
Execute actions at replicated atomic DLL post rollback time. More... | |
bool | pre_commit () |
The method implements a pre-commit hook to add up a new statement typically to a DDL transaction to update the slave info table. More... | |
virtual void | post_commit (bool on_rollback) |
Cleanup of any side effect that pre_commit() inflicts, including restore of the last executed group coordinates in case the current group has been destined to rollback, and signaling to possible waiters in the positive case. 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 size_t | get_number_info_rli_fields () |
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 int | RLI_FLUSH_NO_OPTION {0} |
No flush options given to relay log flush. More... | |
static constexpr int | RLI_FLUSH_IGNORE_SYNC_OPT {1 << 0} |
Ignore server sync options and flush. More... | |
static constexpr int | RLI_FLUSH_IGNORE_GTID_ONLY {1 << 1} |
Flush disresgarding the value of GTID_ONLY. More... | |
Protected Attributes | |
char | group_relay_log_name [FN_REFLEN] |
Event group means a group of events of a transaction. More... | |
ulonglong | group_relay_log_pos |
char | event_relay_log_name [FN_REFLEN] |
ulonglong | event_relay_log_pos |
ulonglong | future_event_relay_log_pos |
my_off_t | event_start_pos |
char | group_master_log_name [FN_REFLEN] |
volatile my_off_t | group_master_log_pos |
Format_description_log_event * | rli_description_event |
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 | is_in_stmt () const |
Auxiliary function used by is_in_group. More... | |
bool | is_in_trx_or_stmt () const |
Auxiliary function used by is_in_group. More... | |
bool | read_info (Rpl_info_handler *from) override |
bool | write_info (Rpl_info_handler *to) override |
Relay_log_info (const Relay_log_info &info) | |
Relay_log_info & | operator= (const Relay_log_info &info) |
const char * | add_channel_to_relay_log_name (char *buff, uint buff_size, const char *base_name) |
sets the suffix required for relay log names in multisource replication. More... | |
Private Attributes | |
bool | group_source_log_seen_start_pos |
Event group beginning event has been seen. More... | |
ulonglong | group_source_log_start_pos |
ulonglong | group_source_log_end_pos |
Gtid_set * | gtid_set |
bool | rli_fake |
bool | gtid_retrieved_initialized |
bool | relay_log_sanitized = false |
Flag that ensures the relay log is sanitized only once. More... | |
Gtid_monitoring_info * | gtid_monitoring_info |
Stores information on the last processed transaction or the transaction that is currently being processed. More... | |
bool | m_relay_log_truncated = false |
It will be set to true when receiver truncated relay log for some reason. More... | |
std::string | m_privilege_checks_username |
The user name part of the user passed on to PRIVILEGE_CHECKS_USER . More... | |
std::string | m_privilege_checks_hostname |
The host name part of the user passed on to PRIVILEGE_CHECKS_USER . More... | |
bool | m_privilege_checks_user_corrupted |
Tells whether or not the internal data regarding PRIVILEGE_CHECKS_USER is corrupted. More... | |
bool | m_require_row_format |
Tells if the slave is only accepting events logged with row based logging. More... | |
enum_require_table_primary_key | m_require_table_primary_key_check |
Identifies what is the slave policy on primary keys in tables. More... | |
bool | m_is_applier_source_position_info_invalid |
Are positions invalid. More... | |
Commit_order_manager * | commit_order_mngr |
time_t | sql_delay |
Delay slave SQL thread by this amount of seconds. More... | |
time_t | sql_delay_end |
During a delay, specifies the point in time when the delay ends. More... | |
uint32 | m_flags |
time_t | row_stmt_start_timestamp |
bool | long_find_row_note_printed |
int | thd_tx_priority |
bool | m_ignore_write_set_memory_limit |
If the SQL thread should or not ignore the set limit for write set collection. More... | |
bool | m_allow_drop_write_set |
Even if a component says all transactions require write sets, this variable says the SQL thread transactions can drop them. More... | |
Until_option * | until_option |
Static Private Attributes | |
static const int | APPLIER_METADATA_LINES_WITH_DELAY = 5 |
static const int | APPLIER_METADATA_LINES_WITH_WORKERS = 6 |
static const int | APPLIER_METADATA_LINES_WITH_ID = 7 |
static const int | APPLIER_METADATA_LINES_WITH_CHANNEL = 8 |
static const int | APPLIER_METADATA_LINES_WITH_PRIV_CHECKS_USERNAME = 9 |
static const int | PRIV_CHECKS_USERNAME_LENGTH = 32 |
static const int | APPLIER_METADATA_LINES_WITH_PRIV_CHECKS_HOSTNAME = 10 |
static const int | PRIV_CHECKS_HOSTNAME_LENGTH = 255 |
static const int | APPLIER_METADATA_LINES_WITH_REQUIRE_ROW_FORMAT = 11 |
static const int | APPLIER_METADATA_LINES_WITH_REQUIRE_TABLE_PRIMARY_KEY_CHECK |
static const int | APPLIER_METADATA_LINES_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_TYPE |
static const int | APPLIER_METADATA_LINES_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE |
static const int | MAXIMUM_APPLIER_METADATA_LINES |
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 |
anonymous enum |
anonymous enum |
|
strong |
Set of possible return values for the member methods related to PRIVILEGE_CHECKS_USER
management.
|
strong |
Identifies what is the replica policy on primary keys in tables.
Relay_log_info::Relay_log_info | ( | bool | is_slave_recovery, |
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, | ||
bool | is_rli_fake | ||
) |
|
override |
|
private |
ulong Relay_log_info::adapt_to_master_version | ( | Format_description_log_event * | fdle | ) |
adaptation for the slave applier to specific master versions.
The method computes the incoming "source"'s FD server version and that of the currently installed (if ever) rli_description_event, to invoke more specific method to compare the two and adapt slave applier execution context to the new incoming master's version.
This method is specifically for STS applier/MTS Coordinator as well as for a user thread applying binlog events.
fdle | a pointer to new Format Description event that is being set up a new execution context. |
ulong Relay_log_info::adapt_to_master_version_updown | ( | ulong | master_version, |
ulong | current_version | ||
) |
The method compares two supplied versions and carries out down- or up- grade customization of execution context of the slave applier (thd).
The method is invoked in the STS case through Relay_log_info::adapt_to_master_version() right before a new master FD is installed into the applier execution context; in the MTS case it's done by the Worker when it's assigned with a first event after the latest new FD has been installed.
Comparison of the current (old, existing) and the master (new, incoming) versions yields adaptive actions. To explain that, let's denote V_0 as the current, and the master's one as V_1. In the downgrade case (V_1 < V_0) a server feature that is undefined in V_1 but is defined starting from some V_f of [V_1 + 1, V_0] range (+1 to mean V_1 excluded) are invalidated ("removed" from execution context) by running so called here downgrade action. Conversely in the upgrade case a feature defined in [V_0 + 1, V_1] range is validated ("added" to execution context) by running its upgrade action. A typical use case showing how adaptive actions are necessary for the slave applier is when the master version is lesser than the slave's one. In such case events generated on the "older" master may need to be applied in their native server context. And such context can be provided by downgrade actions. Conversely, when the old master events are run out and a newer master's events show up for applying, the execution context will be upgraded through the namesake actions.
Notice that a relay log may have two FD events, one the slave local and the other from the Master. As there's no concern for the FD originator this leads to two adapt_to_master_version() calls. It's not harmful as can be seen from the following example. Say the currently installed FD's version is V_m, then at relay-log rotation the following transition takes place:
V_m -adapt-> V_s -adapt-> V_m.
here and further ‘m’ subscript stands for the master, ‘s’ for the slave. It's clear that in this case an ineffective V_m -> V_m transition occurs.
At composing downgrade/upgrade actions keep in mind that the slave applier version transition goes the following route: The initial version is that of the slave server (V_ss). It changes to a magic 4.0 at the slave relay log initialization. In the following course versions are extracted from each FD read out, regardless of what server generated it. Here is a typical version transition sequence underscored with annotation:
V_ss -> 4.0 -> V(FD_s^1) -> V(FD_m^2) —> V(FD_s^3) -> V(FD_m^4) ...
bootstrap 1st relay log rotation 2nd log etc
The upper (^) subscipt enumerates Format Description events, V(FD^i) stands for a function exctracting the version data from the i:th FD.
There won't be any action to execute when info_thd is undefined, e.g at bootstrap.
master_version | an upcoming new version |
current_version | the current version |
|
private |
sets the suffix required for relay log names in multisource replication.
When –relay-log option is not provided, the names of the relay log files are relaylog.0000x or relaylog-CHANNEL.00000x in the case of MSR. However, if that option is provided, then the names of the relay log files are <relay-log-option>.0000x or <relay-log-option>-CHANNEL.00000x in the case of MSR.
The function adds a channel suffix (according to the channel to file name conventions and conversions) to the relay log file.
[in,out] | buff | buffer to store the complete relay log file name |
[in] | buff_size | size of buffer buff |
[in] | base_name | the base name of the relay log file |
enum_return_status Relay_log_info::add_gtid_set | ( | const Gtid_set * | gtid_set | ) |
Adds a GTID set to received GTID set.
gtid_set | the gtid_set to add |
|
inline |
bool Relay_log_info::cached_charset_compare | ( | char * | charset | ) | const |
void Relay_log_info::cached_charset_invalidate | ( | ) |
Last charset (6 bytes) seen by slave SQL thread is cached here; it helps the thread save 3 get_charset()
per Query_log_event
if the charset is not changing from event to event (common situation).
When the 6 bytes are equal to 0 is used to mean "cache is invalidated".
Relay_log_info::enum_priv_checks_status Relay_log_info::check_applier_acl_user | ( | char const * | param_privilege_checks_username, |
char const * | param_privilege_checks_hostname | ||
) |
Checks the existence of user provided as part of the PRIVILEGE_CHECKS_USER
option.
param_privilege_checks_username | the username part of the user. |
param_privilege_checks_hostname | the host part of the user. |
enum_return_check Relay_log_info::check_if_info_was_cleared | ( | const enum_return_check & | previous_result | ) | const |
Checks if the underlying Rpl_info
handler holds information for the fields to be kept between slave resets, while the other fields were cleared.
previous_result | the result return from invoking the check_info method on this object. |
enum_return_check
enumeration. Relay_log_info::enum_priv_checks_status Relay_log_info::check_privilege_checks_user | ( | ) |
Checks the validity and integrity of the data related to PRIVILEGE_CHECKS_USER
, specifically the user name and the user hostname.
Also checks if the user exists.
This method takes no parameters as it checks the values stored in the internal member variables.
Relay_log_info::enum_priv_checks_status Relay_log_info::check_privilege_checks_user | ( | char const * | param_privilege_checks_username, |
char const * | param_privilege_checks_hostname | ||
) |
Checks the validity and integrity of the data related to PRIVILEGE_CHECKS_USER
, specifically the user name and the user hostname.
Also checks if the user exists.
param_privilege_checks_username | the username part of the user. |
param_privilege_checks_hostname | the hostname part of the user. |
|
inline |
|
inline |
void Relay_log_info::cleanup_context | ( | THD * | thd, |
bool | error | ||
) |
|
inline |
Clear the value of a replication state flag.
flag | Flag to clear |
|
inline |
Clears the Gtid_monitoring_info fields.
bool Relay_log_info::clear_info | ( | ) |
Clears from this
Relay_log_info object all attribute values that are not to be kept.
|
inline |
void Relay_log_info::clear_privilege_checks_user | ( | ) |
Clears the info related to the data initialized from PRIVILEGE_CHECKS_USER
.
|
inline |
Clears the processing_trx structure fields.
Normally called when there is an error while processing the transaction.
void Relay_log_info::clear_relay_log_truncated | ( | ) |
Applier clears the flag after it handled the situation.
The caller must hold data_lock.
|
inline |
Reset the delay.
This is used by RESET REPLICA to clear the delay.
void Relay_log_info::clear_tables_to_lock | ( | ) |
When replicating in RBR and MyISAM Merge tables are involved open_and_lock_tables (called in do_apply_event) appends the base tables to the list of tables_to_lock. Then these are removed from the list in close_thread_tables (which is called before we reach this point).
This assertion just confirms that we get no surprises at this point.
|
inline |
void Relay_log_info::close_temporary_tables | ( | ) |
|
virtual |
The method implements updating a slave info table.
It's specialized differently for STS and MTS.
Reimplemented in Slave_worker.
int Relay_log_info::count_relay_log_space | ( | ) |
void Relay_log_info::deinit_workers | ( | ) |
The method to invoke at slave threads stop.
void Relay_log_info::detach_engine_ha_data | ( | THD * | thd | ) |
Detaches the engine ha_data from THD.
The fact is memorized in m_is_engine_ha_data_detached
flag.
thd | a reference to THD |
void Relay_log_info::end_info | ( | ) |
void Relay_log_info::fill_coord_err_buf | ( | loglevel | level, |
int | err_code, | ||
const char * | buff_coord | ||
) | const |
Update the error number, message and timestamp fields.
This function is different from va_report() as va_report() also logs the error message in the log apart from updating the error fields.
SYNOPSIS
[in] | level | specifies the level- error, warning or information, |
[in] | err_code | error number, |
[in] | buff_coord | error message to be used. |
|
inline |
When the processing of a transaction is completed, that timestamp is recorded, the information is copied to last_processed_trx and the information in processing_trx is cleared.
If the transaction was "applied" but GTID-skipped, the copy will not happen and the last_processed_trx will keep its current value.
int Relay_log_info::flush_current_log | ( | ) |
int Relay_log_info::flush_info | ( | const int | flush_flags | ) |
Stores the file and position where the execute-slave thread are in the relay log:
0 | ok, |
1 | write error, otherwise. Store the file and position where the slave's SQL thread are in the relay log. |
Notes:
flush_flags | a bit mask to force flushing in some scenarios If RLI_FLUSH_IGNORE_SYNC_OPT is given then the method will ignore the server sync options If RLI_FLUSH_IGNORE_GTID_ONLY is given then the method will ignore the channel GTID_ONLY option |
|
inline |
|
inlinevirtual |
Get coordinator's RLI.
Especially used get the rli from a slave thread, like this: thd->rli_slave->get_c_rli(); thd could be a SQL thread or a worker thread
Reimplemented in Slave_worker.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the value of a replication state flag.
flag | Flag to get value of |
true
if the flag was set, false
otherwise.
|
overridevirtual |
Implements Slave_reporting_capability.
Reimplemented in Slave_worker.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get event group positions in source binary log on a replica which is processed by a worker in MTA or coordinator in STA.
|
inline |
|
inline |
|
inline |
|
static |
std::string Relay_log_info::get_privilege_checks_hostname | ( | ) | const |
Retrieves the host part of the PRIVILEGE_CHECKS_USER
option of CHANGE MASTER TO
statement.
std::string Relay_log_info::get_privilege_checks_username | ( | ) | const |
Retrieves the username part of the PRIVILEGE_CHECKS_USER
option of CHANGE MASTER TO
statement.
Relay_log_info::enum_require_table_primary_key Relay_log_info::get_require_table_primary_key_check | ( | ) | const |
Returns what is the slave policy concerning primary keys on replicated tables.
|
inline |
Return the current Format_description_log_event.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
const char * Relay_log_info::get_until_log_name | ( | ) |
my_off_t Relay_log_info::get_until_log_pos | ( | ) |
|
inline |
|
inline |
|
inline |
int Relay_log_info::inc_group_relay_log_pos | ( | ulonglong | log_pos, |
bool | need_data_lock, | ||
bool | force = false |
||
) |
Last executed event group coordinates are updated and optionally forcibly flushed to a repository.
log_pos | a value of the executed position to update to |
need_data_lock | whether data_lock should be acquired |
force | the value is passed to eventual flush_info() |
int Relay_log_info::init_until_option | ( | THD * | thd, |
const LEX_SOURCE_INFO * | master_param | ||
) |
Initialize until option object when starting slave.
[in] | thd | The thread object of current session. |
[in] | master_param | the parameters of START REPLICA. |
0 | Succeeds to initialize until option object. |
<> | 0 A defined error number is return if any error happens. |
void Relay_log_info::init_workers | ( | ulong | n_workers | ) |
The method to invoke at slave threads start.
Relay_log_info::enum_priv_checks_status Relay_log_info::initialize_applier_security_context | ( | ) |
Initializes the security context associated with the PRIVILEGE_CHECKS_USER
user that is to be used by the applier thread.
Relay_log_info::enum_priv_checks_status Relay_log_info::initialize_security_context | ( | THD * | thd | ) |
Initializes the security context associated with the PRIVILEGE_CHECKS_USER
user that is to be used by the provided THD object.
bool Relay_log_info::is_applier_source_position_info_invalid | ( | ) | const |
Returns if the applier positions are marked as being invalid or not.
|
inline |
Checks whether engine ha data is detached from THD.
true | if the data is detached |
false | if the data is not detached |
bool Relay_log_info::is_group_relay_log_name_invalid | ( | const char ** | errmsg | ) |
Check if group_relay_log_name is in index file.
[out] | errmsg | An error message is returned if error happens. |
false | It is valid. |
true | It is invalid. In this case, *errmsg is set to point to the error message. |
|
inline |
A group is defined as the entire range of events that constitute a transaction or auto-committed statement.
It has one of the following forms:
(Gtid)? Query(BEGIN) ... (Query(COMMIT) | Query(ROLLBACK) | Xid) (Gtid)? (Rand | User_var | Int_var)* Query(DDL)
Thus, to check if the execute thread is in a group, there are two cases:
true | Replication thread is inside a group. |
false | Replication thread is not inside a group. |
|
inlineprivate |
Auxiliary function used by is_in_group.
The execute thread is in the middle of a statement in the following cases:
true | Replication thread is inside a statement. |
false | Replication thread is not inside a statement. |
|
inlineprivate |
Auxiliary function used by is_in_group.
true | The execute thread is inside a statement or a transaction, i.e., either a BEGIN has been executed or we are in the middle of a statement. |
false | The execute thread thread is not inside a statement or a transaction. |
|
inline |
|
inline |
returns true if Coordinator is scheduling events belonging to the same group and has not reached yet its terminal event.
|
inline |
returns true if there is any gap-group of events to execute at slave starting phase.
|
inline |
returns true if events are to be executed in parallel
bool Relay_log_info::is_privilege_checks_user_corrupted | ( | ) | const |
Returns whether or not the internal data regarding PRIVILEGE_CHECKS_USER
is corrupted.
This may happen, for instance, if the user tries to change the Relay_log_info repository manually or after a server crash.
bool Relay_log_info::is_privilege_checks_user_null | ( | ) | const |
Returns whether or not there is no user configured for PRIVILEGE_CHECKS_USER
.
PRIVILEGE_CHECKS_USER
and false otherwise.
|
inline |
|
inline |
bool Relay_log_info::is_row_format_required | ( | ) | const |
Returns whether the slave is running in row mode only.
bool Relay_log_info::is_time_for_mta_checkpoint | ( | ) |
Check if it is time to compute MTS checkpoint.
true | It is time to compute MTS checkpoint. |
false | It is not MTS or it is not time for computing checkpoint. |
|
inline |
|
inline |
|
inline |
|
inline |
bool Relay_log_info::mts_finalize_recovery | ( | ) |
Called when gaps execution is ended so it is crash-safe to reset the last session Workers info.
Reset recovery info from Worker info table and mark MTS recovery is completed.
reset_notified_checkpoint
failed.
|
inline |
The same as notify_group_relay_log_name_update
but for group_master_log_name
.
|
inline |
Invalidates cached until_log_name and event_relay_log_name comparison result.
Should be called after switch to next relay log if there chances that sql_thread is running.
void Relay_log_info::notify_relay_log_truncated | ( | ) |
Receiver thread notifies that it truncated some data from relay log.
data_lock will be acquired, so the caller should not hold data_lock.
|
private |
|
virtual |
Cleanup of any side effect that pre_commit() inflicts, including restore of the last executed group coordinates in case the current group has been destined to rollback, and signaling to possible waiters in the positive case.
on_rollback | when true the method carries out rollback action |
Reimplemented in Slave_worker.
|
inline |
Execute actions at replicated atomic DLL post rollback time.
This include marking the current atomic DDL query-log-event as having processed. This measure is necessary to avoid slave info table update execution when pre_commit()
hook is called as part of DDL's eventual implicit commit.
|
inline |
The method implements a pre-commit hook to add up a new statement typically to a DDL transaction to update the slave info table.
Note, in the non-transactional repository case the slave info is updated after successful commit of the main transaction.
std::pair< const char *, const char * > Relay_log_info::print_applier_security_context_user_host | ( | ) | const |
Returns a printable representation of the username and hostname currently being used in the applier security context or empty strings other wise.
std::pair
containing the username and the hostname printable representations. int Relay_log_info::purge_relay_logs | ( | THD * | thd, |
const char ** | errmsg, | ||
bool | delete_only = false |
||
) |
Purges relay logs.
It assumes to have a run lock on rli and that no slave thread are running.
[in] | thd | connection, |
[out] | errmsg | store pointer to an error message. |
[in] | delete_only | If true, do not start writing to a new log file. |
0 | successfully executed, |
1 | otherwise error, where errmsg is set to point to the error message. |
Clear the retrieved gtid set for this channel.
|
overrideprivatevirtual |
Implements Rpl_info.
Reimplemented in Slave_worker.
void Relay_log_info::reattach_engine_ha_data | ( | THD * | thd | ) |
Reattaches the engine ha_data to THD.
The fact is memorized in m_is_engine_ha_data_detached
flag.
thd | a reference to THD |
bool Relay_log_info::reinit_sql_thread_io_cache | ( | const char * | log, |
bool | need_data_lock | ||
) |
void Relay_log_info::report_privilege_check_error | ( | enum loglevel | level, |
enum_priv_checks_status | status_code, | ||
bool | to_client, | ||
char const * | channel_name = nullptr , |
||
char const * | user_name = nullptr , |
||
char const * | host_name = nullptr |
||
) | const |
Outputs the error message associated with applier thread user privilege checks error error_code
.
The output stream to which is outputted is decided based on to_client
which, if set to true
will output the message to the client session and if false
will output to the server log.
level | the message urgency level, e.g., ERROR_LEVEL , WARNING_LEVEL , etc. |
status_code | the status code to output the associated error message for. |
to_client | a flag indicating if the message should be sent to the client session or to the server log. |
channel_name | name of the channel for which the error is being reported. |
user_name | username for which the error is being reported. |
host_name | hostname for which the error is being reported. |
bool Relay_log_info::reset_group_relay_log_pos | ( | const char ** | errmsg | ) |
Reset group_relay_log_name and group_relay_log_pos to the start of the first relay log file.
The caller must hold data_lock.
[out] | errmsg | An error message is set into it if error happens. |
false | Success |
true | Error |
void Relay_log_info::reset_notified_checkpoint | ( | ulong | shift, |
time_t | new_ts, | ||
bool | update_timestamp = false |
||
) |
While a group is executed by a Worker the relay log can change.
This method is called in mta_checkpoint_routine() to mark that each worker is required to adapt to a new checkpoint data whose coordinates are passed to it through GAQ index.
Coordinator notifies Workers about this event. Coordinator and Workers maintain a bitmap of executed group that is reset with a new checkpoint.
Worker notices the new checkpoint value at the group commit to reset the current bitmap and starts using the clean bitmap indexed from zero of being reset rli_checkpoint_seqno.
New seconds_behind_source timestamp is installed.
shift | number of bits to shift by Worker due to the current checkpoint change. |
new_ts | new seconds_behind_source timestamp value unless zero. Zero could be due to FD event or fake rotate event. |
update_timestamp | if true, this function will update the rli->last_master_timestamp. |
void Relay_log_info::reset_notified_relay_log_change | ( | ) |
While a group is executed by a Worker the relay log can change.
Method is called when MTS coordinator senses the relay-log name has been changed.
Coordinator notifies Workers about this event. Worker is supposed to commit to the recovery table with the new info.
It marks each Worker member with this fact to make an action at time it will distribute a terminal event of a group to the Worker.
Worker receives the new name at the group committing phase Slave_worker::slave_worker_ends_group()
.
|
inline |
|
inline |
When a transaction is retried, the error number and message, and total number of retries are stored.
The timestamp for this error is also set here.
transient_errno_arg | Transient error number. |
transient_err_message_arg | Transient error message. |
trans_retries_arg | Number of times this transaction has been retried so far. |
int Relay_log_info::rli_init_info | ( | bool | skip_received_gtid_set_and_relaylog_recovery = false | ) |
Initialize the relay log info.
This function does a set of operations on the rli object like initializing variables, loading information from repository, setting up name for relay log files and index, MTS recovery (if necessary), calculating the received GTID set for the channel and storing the updated rli object configuration into the repository.
When this function is called in a change replication source process and the change procedure will purge all the relay log files later, there is no reason to try to calculate the received GTID set of the channel based on existing relay log files (they will be purged). Allowing reads to existing relay log files at this point may lead to put the server in a state where it will be no possible to configure it if it was reset when encryption of replication log files was ON and the keyring plugin is not available anymore.
skip_received_gtid_set_and_relaylog_recovery | When true, skips the received GTID set and relay log recovery. |
0 | Success. |
1 | Error. |
|
inline |
void Relay_log_info::set_applier_source_position_info_invalid | ( | bool | invalid | ) |
Marks the applier position information as being invalid or not.
invalid | value to set the position/file info as invalid or not |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set replication filter for the channel.
|
inline |
Set the value of a replication state flag.
flag | Flag to set |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Relay_log_info::set_group_source_log_start_end_pos | ( | const Log_event * | ev | ) |
Process an event and based on its type () set group beginning and end.
ev | - event within a group (including first and last) |
|
inline |
|
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.
Reimplemented in Slave_worker.
|
inline |
void Relay_log_info::set_master_info | ( | Master_info * | info | ) |
|
static |
Sets bits for columns that are allowed to be NULL
.
nullable_fields | the bitmap to hold the nullable fields. |
Relay_log_info::enum_priv_checks_status Relay_log_info::set_privilege_checks_user | ( | char const * | param_privilege_checks_username, |
char const * | param_privilege_checks_hostname | ||
) |
Initializes data related to PRIVILEGE_CHECKS_USER
, specifically the user name and the user hostname.
param_privilege_checks_username | the username part of the user. |
param_privilege_checks_hostname | the hostname part of the user. |
void Relay_log_info::set_privilege_checks_user_corrupted | ( | bool | is_corrupted | ) |
Sets the flag that tells whether or not the data regarding the PRIVILEGE_CHECKS_USER
is corrupted.
is_corrupted | the flag value. |
void Relay_log_info::set_require_row_format | ( | bool | require_row | ) |
Sets the flag that tells whether or not the slave is running in row mode only.
require_row | the flag value. |
void Relay_log_info::set_require_table_primary_key_check | ( | Relay_log_info::enum_require_table_primary_key | require_pk | ) |
Sets the field that tells what is the slave policy concerning primary keys on replicated tables.
require_pk | the policy value. |
|
virtual |
Delete the existing event and set a new one.
The method is run by SQL thread/MTS Coordinator.
This class is responsible for freeing the event, the caller should not do that.
It replaces the current FD event with a new one. A version adaptation routine is invoked for the new FD to align the slave applier execution context with the master version.
Since FD are shared by Coordinator and Workers in the MTS mode, deletion of the old FD is done through decrementing its usage counter. The destructor runs when the later drops to zero, also see Slave_worker::set_rli_description_event()
. The usage counter of the new FD is incremented.
Although notice that MTS worker runs it, inefficiently (see assert), once at its destruction time.
fe | Pointer to be installed into execution context FormatDescriptor event |
Reimplemented in Slave_worker.
|
inline |
|
inline |
|
inline |
|
inline |
void Relay_log_info::slave_close_thread_tables | ( | THD * | thd | ) |
void Relay_log_info::start_sql_delay | ( | time_t | delay_end | ) |
Indicate that a delay starts.
This does not actually sleep; it only sets the state of this Relay_log_info object to delaying so that the correct state can be reported by SHOW REPLICA STATUS and SHOW PROCESSLIST.
Requires rli->data_lock.
delay_end | The time when the delay shall end. |
|
inline |
Stores the details of the transaction which has just started processing.
This function is called by the STS applier or MTS worker when applying a Gtid.
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 |
skipped | true if the transaction was gtid skipped |
|
inline |
Stores the details of the transaction which has just started processing.
This function is called by the MTS coordinator when queuing a Gtid to a worker.
gtid_log_ev_arg | the gtid log event of the trx |
int Relay_log_info::stmt_done | ( | my_off_t | event_log_pos | ) |
Helper function to do after statement completion.
This function is called from an event to complete the group by either stepping the group position, if the "statement" is not inside a transaction; or increase the event position, if the "statement" is inside a transaction.
event_log_pos | Master log position of the event. The position is recorded in the relay log info and used to produce information for SHOW SLAVE STATUS . |
|
inline |
int Relay_log_info::wait_for_gtid_set | ( | THD * | thd, |
const char * | gtid, | ||
double | timeout, | ||
bool | update_THD_status = true |
||
) |
Wait for a GTID set to be executed.
thd | The thread for status changes and kill status |
gtid | A char array with a GTID set |
timeout | Number of seconds to wait before timing out |
update_THD_status | Shall the method update the THD stage |
0 | The set is already executed |
-1 | There was a timeout waiting for the set |
-2 | There was an issue while waiting. |
int Relay_log_info::wait_for_gtid_set | ( | THD * | thd, |
const Gtid_set * | wait_gtid_set, | ||
double | timeout, | ||
bool | update_THD_status = true |
||
) |
Wait for a GTID set to be executed.
thd | The thread for status changes and kill status |
wait_gtid_set | A GTID_set object |
timeout | Number of seconds to wait before timing out |
update_THD_status | Shall the method update the THD stage |
0 | The set is already executed |
-1 | There was a timeout waiting for the set |
-2 | There was an issue while waiting. |
int Relay_log_info::wait_for_gtid_set | ( | THD * | thd, |
String * | gtid, | ||
double | timeout, | ||
bool | update_THD_status = true |
||
) |
Wait for a GTID set to be executed.
thd | The thread for status changes and kill status |
gtid | A String with a GTID set |
timeout | Number of seconds to wait before timing out |
update_THD_status | Shall the method update the THD stage |
0 | The set is already executed |
-1 | There was a timeout waiting for the set |
-2 | There was an issue while waiting. |
Waits until the SQL thread reaches (has executed up to) the log/position or timed out.
SYNOPSIS
[in] | thd | client thread that sent SELECT SOURCE_POS_WAIT , |
[in] | log_name | log name to wait for, |
[in] | log_pos | position to wait for, |
[in] | timeout | timeout in seconds before giving up waiting. timeout is double whereas it should be ulong; but this is to catch if the user submitted a negative timeout. |
-2 | improper arguments (log_pos<0) or slave not running, or master info changed during the function's execution, or client thread killed. -2 is translated to NULL by caller, |
-1 | timed out |
>=0 | number of log events the function had to wait before reaching the desired log/position |
|
overrideprivatevirtual |
Implements Rpl_info.
Reimplemented in Slave_worker.
|
friend |
std::atomic<ulong> Relay_log_info::abort_pos_wait |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
std::atomic<int32> Relay_log_info::atomic_channel_open_temp_tables {0} |
char Relay_log_info::cached_charset[6] |
enum_mts_parallel_type Relay_log_info::channel_mts_submode |
uint Relay_log_info::checkpoint_group |
|
private |
enum { ... } Relay_log_info::commit_timestamps_status |
the status of the commit timestamps for the relay log
std::string Relay_log_info::coordinator_log_after_purge {""} |
Prealloced_array<db_worker_hash_entry *, 4> Relay_log_info::curr_group_assigned_parts |
Prealloced_array<Slave_job_item, 8> Relay_log_info::curr_group_da |
bool Relay_log_info::curr_group_isolated |
bool Relay_log_info::curr_group_seen_begin |
bool Relay_log_info::curr_group_seen_gtid |
Log_event* Relay_log_info::current_event |
Reference to being applied event.
The member is set at event reading and gets reset at the end of the event lifetime. See more in RLI_current_event_raii
that provides the main interface to the member.
Mts_submode* Relay_log_info::current_mts_submode |
bool Relay_log_info::ddl_not_atomic |
Raised when slave applies and writes to its binary log statement which is not atomic DDL and has no XID assigned.
Checked at commit time to decide whether it is safe to update slave info table within the same transaction as the write to binary log or this should be deferred. The deferred scenario applies for not XIDed events in which case such update might be lost on recovery.
Deferred_log_events* Relay_log_info::deferred_events |
bool Relay_log_info::deferred_events_collecting |
bool Relay_log_info::error_on_rli_init_info |
|
protected |
|
protected |
|
protected |
mysql_mutex_t Relay_log_info::exit_count_lock |
ulong Relay_log_info::exit_counter |
bool Relay_log_info::force_flush_postponed_due_to_split_trans |
|
protected |
Slave_committed_queue* Relay_log_info::gaq |
|
protected |
|
protected |
|
protected |
Event group means a group of events of a transaction.
group_relay_log_name and group_relay_log_pos record the place before where all event groups are applied. When slave starts, it resume to apply events from group_relay_log_pos. They will be initialized to the begin of the first relay log file if it is a new slave(including SLAVE RESET). Then, group_relay_log_pos is advanced after each transaction is applied successfully in single thread slave. For MTS, group_relay_log_pos is updated by mts checkpoint mechanism. group_relay_log_pos and group_relay_log_name are stored into relay_log_info file/table periodically. When server startup, they are loaded from relay log info file/table.
|
protected |
|
private |
|
private |
Event group beginning event has been seen.
Event group may begin with two events marked as beginning.
|
private |
|
private |
Stores information on the last processed transaction or the transaction that is currently being processed.
STS:
MTS:
|
private |
|
private |
char Relay_log_info::ign_master_log_name_end[FN_REFLEN] |
ulonglong Relay_log_info::ign_master_log_pos_end |
bool Relay_log_info::inited_hash_workers |
bool Relay_log_info::is_group_master_log_pos_invalid |
Flag that the group_master_log_pos is invalid.
This may occur (for example) after CHANGE REPLICATION SOURCE TO RELAY_LOG_POS. This will be unset after the first event has been executed and the group_master_log_pos is valid again.
Check also m_is_applier_position_info_invalid
std::atomic_bool Relay_log_info::is_receiver_waiting_for_rl_space |
bool Relay_log_info::is_relay_log_recovery |
Slave_worker* Relay_log_info::last_assigned_worker |
struct timespec Relay_log_info::last_clock |
Identifies the last time a checkpoint routine has been executed.
time_t Relay_log_info::last_event_start_time |
time_t Relay_log_info::last_master_timestamp |
mysql_cond_t Relay_log_info::log_space_cond |
std::atomic<ulonglong> Relay_log_info::log_space_limit |
mysql_mutex_t Relay_log_info::log_space_lock |
std::atomic<ulonglong> Relay_log_info::log_space_total |
mysql_cond_t Relay_log_info::logical_clock_cond |
|
private |
|
private |
Even if a component says all transactions require write sets, this variable says the SQL thread transactions can drop them.
Assign_gtids_to_anonymous_transactions_info Relay_log_info::m_assign_gtids_to_anonymous_transactions_info |
Stores the information related to the ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS parameter of CHANGE REPLICATION SOURCE.
|
private |
|
private |
If the SQL thread should or not ignore the set limit for write set collection.
|
private |
Are positions invalid.
If true it means the applier related position information (group_master_log_name and group_master_log_pos) might be outdated.
Check also is_group_master_log_pos_invalid
bool Relay_log_info::m_is_engine_ha_data_detached |
PSI_mutex_key Relay_log_info::m_key_mta_temp_table_LOCK |
|
private |
The host name part of the user passed on to PRIVILEGE_CHECKS_USER
.
|
private |
Tells whether or not the internal data regarding PRIVILEGE_CHECKS_USER
is corrupted.
This may happen if the user tries to change the Relay_log_info repository by hand.
|
private |
The user name part of the user passed on to PRIVILEGE_CHECKS_USER
.
|
private |
It will be set to true when receiver truncated relay log for some reason.
The truncated data may already be read by applier. So applier need to check it each time the binlog_end_pos is updated.
|
private |
Tells if the slave is only accepting events logged with row based logging.
It also blocks Operations with temporary table creation/deletion Operations with LOAD DATA Events: INTVAR_EVENT, RAND_EVENT, USER_VAR_EVENT
|
private |
Identifies what is the slave policy on primary keys in tables.
If set to STREAM it just replicates the value of sql_require_primary_key. If set to ON it fails when the source tries to replicate a table creation or alter operation that does not have a primary key. If set to OFF it does not enforce any policies on the channel for primary keys. If set to GENERATE it adds GIPKs to tables that are created without a PK in the replica applier threads.
table_mapping Relay_log_info::m_table_map |
malloc_unordered_map<std::string, unique_ptr_with_deleter<db_worker_hash_entry> > Relay_log_info::mapping_db_to_worker {key_memory_db_worker_hash_entry} |
ulonglong Relay_log_info::max_updated_index |
|
staticprivate |
Master_info* Relay_log_info::mi |
time_t Relay_log_info::mta_coordinator_has_waited_stat |
Last moment in time the MTA printed a coordinator waited stats.
ulong Relay_log_info::mts_coordinator_basic_nap |
bool Relay_log_info::mts_end_group_sets_max_dbs |
ulonglong Relay_log_info::mts_events_assigned |
mysql_mutex_t Relay_log_info::mts_gaq_LOCK |
enum { ... } Relay_log_info::mts_group_status |
ulonglong Relay_log_info::mts_groups_assigned |
time_t Relay_log_info::mts_last_online_stat |
long Relay_log_info::mts_online_stat_curr |
ulonglong Relay_log_info::mts_pending_jobs_size |
ulonglong Relay_log_info::mts_pending_jobs_size_max |
ulong Relay_log_info::mts_recovery_group_cnt |
bool Relay_log_info::mts_recovery_group_seen_begin |
ulong Relay_log_info::mts_recovery_index |
ulong Relay_log_info::mts_slave_worker_queue_len_max |
mysql_mutex_t Relay_log_info::mts_temp_table_LOCK |
std::atomic<longlong> Relay_log_info::mts_total_wait_overlap |
ulonglong Relay_log_info::mts_total_wait_worker_avail |
long Relay_log_info::mts_worker_underrun_level |
std::atomic<long> Relay_log_info::mts_wq_excess_cnt |
ulong Relay_log_info::mts_wq_no_underrun_cnt |
ulong Relay_log_info::mts_wq_overfill_cnt |
std::atomic<ulong> Relay_log_info::mts_wq_overrun_cnt |
bool Relay_log_info::mts_wq_oversize |
volatile ulong Relay_log_info::mts_wq_underrun_w_id |
char Relay_log_info::new_group_master_log_name[FN_REFLEN] |
Storage for holding newly computed values for the last executed event group coordinates while the current group of events is being committed, see pre_commit
, post_commit.
my_off_t Relay_log_info::new_group_master_log_pos |
char Relay_log_info::new_group_relay_log_name[FN_REFLEN] |
my_off_t Relay_log_info::new_group_relay_log_pos |
ulong Relay_log_info::opt_replica_parallel_workers |
uint64 Relay_log_info::original_commit_timestamp |
std::atomic<ulong> Relay_log_info::pending_jobs |
mysql_cond_t Relay_log_info::pending_jobs_cond |
mysql_mutex_t Relay_log_info::pending_jobs_lock |
|
staticprivate |
|
staticprivate |
MY_BITMAP Relay_log_info::recovery_groups |
bool Relay_log_info::recovery_groups_inited |
ulong Relay_log_info::recovery_parallel_workers |
MYSQL_BIN_LOG Relay_log_info::relay_log |
|
private |
Flag that ensures the relay log is sanitized only once.
ulong Relay_log_info::replica_parallel_workers |
bool Relay_log_info::replicate_same_server_id |
bool Relay_log_info::reported_unsafe_warning |
ulong Relay_log_info::retried_trans |
uint Relay_log_info::rli_checkpoint_seqno |
|
protected |
|
private |
|
staticconstexpr |
Flush disresgarding the value of GTID_ONLY.
|
staticconstexpr |
Ignore server sync options and flush.
|
staticconstexpr |
No flush options given to relay log flush.
|
private |
Rows_query_log_event* Relay_log_info::rows_query_ev |
Rpl_filter* Relay_log_info::rpl_filter |
TABLE* Relay_log_info::save_temporary_tables |
char Relay_log_info::slave_patternload_file[FN_REFLEN] |
size_t Relay_log_info::slave_patternload_file_size |
std::atomic<uint32> Relay_log_info::slave_skip_counter |
uchar Relay_log_info::slave_version_split[3] |
mysql_cond_t Relay_log_info::slave_worker_hash_cond |
mysql_mutex_t Relay_log_info::slave_worker_hash_lock |
|
private |
Delay slave SQL thread by this amount of seconds.
The delay is applied per transaction and based on the immediate master's commit time. Exceptionally, if a server in the replication chain does not support the commit timestamps in Gtid_log_event, the delay is applied per event and is based on the event timestamp. This is set with CHANGE REPLICATION SOURCE TO SOURCE_DELAY=X.
Guarded by data_lock. Initialized by the client thread executing START REPLICA. Written by client threads executing CHANGE REPLICATION SOURCE TO SOURCE_DELAY=X. Read by SQL thread and by client threads executing SHOW REPLICA STATUS. Note: must not be written while the slave SQL thread is running, since the SQL thread reads it without a lock when executing flush_info().
|
private |
During a delay, specifies the point in time when the delay ends.
This is used for the SQL_Remaining_Delay column in SHOW REPLICA STATUS.
Guarded by data_lock. Written by the sql thread. Read by client threads executing SHOW REPLICA STATUS.
bool Relay_log_info::sql_thread_kill_accepted |
struct timespec Relay_log_info::stats_begin |
ulonglong Relay_log_info::stats_exec_time |
ulonglong Relay_log_info::stats_read_time |
RPL_Table_ref* Relay_log_info::tables_to_lock |
uint Relay_log_info::tables_to_lock_count |
|
private |
ulong Relay_log_info::trans_retries |
Replication_transaction_boundary_parser Relay_log_info::transaction_parser |
struct timespec Relay_log_info::ts_exec[2] |
enum { ... } Relay_log_info::until_condition |
|
private |
Slave_worker_array Relay_log_info::workers |
bool Relay_log_info::workers_array_initialized |
std::vector<Slave_worker *> Relay_log_info::workers_copy_pfs |
ulong Relay_log_info::wq_size_waits_cnt |