MySQL 8.0.40
Source Code Documentation
Relay_log_info Class Reference

#include <rpl_rli.h>

Inheritance diagram for Relay_log_info:
[legend]

Public Types

enum class  enum_priv_checks_status : int {
  SUCCESS = 0 , USER_ANONYMOUS , USERNAME_TOO_LONG , HOSTNAME_TOO_LONG ,
  HOSTNAME_SYNTAX_ERROR , USERNAME_NULL_HOSTNAME_NOT_NULL , USER_DOES_NOT_EXIST , USER_DOES_NOT_HAVE_PRIVILEGES ,
  USER_DATA_CORRUPTED , LOAD_DATA_EVENT_NOT_ALLOWED
}
 Set of possible return values for the member methods related to PRIVILEGE_CHECKS_USER management. More...
 
enum class  enum_require_row_status : int { SUCCESS = 0 , PRIV_CHECKS_USER_NOT_NULL }
 
enum  enum_state_flag { IN_STMT , STATE_FLAGS_COUNT }
 Flags for the state of the replication. More...
 
enum  enum_require_table_primary_key {
  PK_CHECK_NONE = 0 , PK_CHECK_STREAM = 1 , PK_CHECK_ON = 2 , PK_CHECK_OFF = 3 ,
  PK_CHECK_GENERATE = 4
}
 Identifies what is the replica policy on primary keys in tables. More...
 
enum  { COMMIT_TS_UNKNOWN , COMMIT_TS_NOT_FOUND , COMMIT_TS_FOUND }
 the status of the commit timestamps for the relay log More...
 
enum  {
  UNTIL_NONE = 0 , UNTIL_MASTER_POS , UNTIL_RELAY_POS , UNTIL_SQL_BEFORE_GTIDS ,
  UNTIL_SQL_AFTER_GTIDS , UNTIL_SQL_AFTER_MTS_GAPS , UNTIL_SQL_VIEW_ID , UNTIL_DONE
}
 
enum  { MTS_NOT_IN_GROUP , MTS_IN_GROUP , MTS_END_GROUP , MTS_KILLED_GROUP }
 

Public Member Functions

bool belongs_to_client ()
 
Gtid_monitoring_infoget_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, ulonglongget_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 ()
 
Sid_mapget_sid_map ()
 
Checkable_rwlockget_sid_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_setget_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_workerget_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_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_eventget_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_managerget_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_infoget_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 ()
 
int init_until_option (THD *thd, const LEX_MASTER_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_handlerget_rpl_info_handler ()
 Gets the persistency component/handler. More...
 
enum_return_check check_info () const
 
int remove_info ()
 
int clean_info ()
 
bool is_transactional () const
 
bool update_is_transactional ()
 
char * get_description_info () const
 
bool copy_info (Rpl_info_handler *from, Rpl_info_handler *to)
 
uint get_internal_id () const
 
char * get_channel () const
 
- Public Member Functions inherited from Slave_reporting_capability
 Slave_reporting_capability (char const *thread_name)
 Constructor. More...
 
virtual void report (loglevel level, int err_code, const char *msg,...) const
 Writes a message and, if it's an error message, to Last_Error (which will be displayed by SHOW SLAVE STATUS). More...
 
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...
 

Public Attributes

Rpl_filterrpl_filter
 
Assign_gtids_to_anonymous_transactions_info m_assign_gtids_to_anonymous_transactions_info
 Stores the information related to the ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS parameter of CHANGE MASTER. More...
 
PSI_mutex_key m_key_mta_temp_table_LOCK
 
mysql_mutex_t mts_temp_table_LOCK
 
mysql_mutex_t mts_gaq_LOCK
 
mysql_cond_t logical_clock_cond
 
bool replicate_same_server_id
 
MYSQL_BIN_LOG relay_log
 
bool is_relay_log_recovery
 
TABLEsave_temporary_tables
 
Master_infomi
 
std::atomic< int32atomic_channel_open_temp_tables {0}
 
enum Relay_log_info:: { ... }  commit_timestamps_status
 the status of the commit timestamps for the relay log More...
 
bool error_on_rli_init_info
 
Replication_transaction_boundary_parser transaction_parser
 
bool is_group_master_log_pos_invalid
 Flag that the group_master_log_pos is invalid. More...
 
std::atomic< ulonglonglog_space_limit
 
std::atomic< ulonglonglog_space_total
 
std::atomic_bool is_receiver_waiting_for_rl_space
 
std::string coordinator_log_after_purge {""}
 
time_t last_master_timestamp
 
volatile uint32 slave_skip_counter
 
volatile ulong abort_pos_wait
 
mysql_mutex_t log_space_lock
 
mysql_cond_t log_space_cond
 
enum Relay_log_info:: { ... }  until_condition
 
char cached_charset [6]
 
ulong trans_retries
 
ulong retried_trans
 
char ign_master_log_name_end [FN_REFLEN]
 
ulonglong ign_master_log_pos_end
 
char slave_patternload_file [FN_REFLEN]
 
size_t slave_patternload_file_size
 
struct timespec last_clock
 Identifies the last time a checkpoint routine has been executed. More...
 
RPL_Table_reftables_to_lock
 
uint tables_to_lock_count
 
table_mapping m_table_map
 
Rows_query_log_eventrows_query_ev
 
time_t last_event_start_time
 
uint64 original_commit_timestamp
 
Deferred_log_eventsdeferred_events
 
bool deferred_events_collecting
 
Slave_worker_array workers
 
malloc_unordered_map< std::string, unique_ptr_with_deleter< db_worker_hash_entry > > mapping_db_to_worker {key_memory_db_worker_hash_entry}
 
bool inited_hash_workers
 
mysql_mutex_t slave_worker_hash_lock
 
mysql_cond_t slave_worker_hash_cond
 
std::vector< Slave_worker * > workers_copy_pfs
 
bool workers_array_initialized
 
volatile ulong pending_jobs
 
mysql_mutex_t pending_jobs_lock
 
mysql_cond_t pending_jobs_cond
 
mysql_mutex_t exit_count_lock
 
ulong mts_slave_worker_queue_len_max
 
ulonglong mts_pending_jobs_size
 
ulonglong mts_pending_jobs_size_max
 
bool mts_wq_oversize
 
Slave_workerlast_assigned_worker
 
Slave_committed_queuegaq
 
Prealloced_array< db_worker_hash_entry *, 4 > curr_group_assigned_parts
 
Prealloced_array< Slave_job_item, 8 > curr_group_da
 
bool curr_group_seen_gtid
 
bool curr_group_seen_begin
 
bool curr_group_isolated
 
bool mts_end_group_sets_max_dbs
 
volatile ulong mts_wq_underrun_w_id
 
volatile long mts_wq_excess_cnt
 
long mts_worker_underrun_level
 
ulong mts_coordinator_basic_nap
 
ulong opt_replica_parallel_workers
 
ulong replica_parallel_workers
 
ulong exit_counter
 
ulonglong max_updated_index
 
ulong recovery_parallel_workers
 
uint rli_checkpoint_seqno
 
uint checkpoint_group
 
MY_BITMAP recovery_groups
 
bool recovery_groups_inited
 
ulong mts_recovery_group_cnt
 
ulong mts_recovery_index
 
bool mts_recovery_group_seen_begin
 
enum Relay_log_info:: { ... }  mts_group_status
 
ulonglong mts_events_assigned
 
ulonglong mts_groups_assigned
 
volatile ulong mts_wq_overrun_cnt
 
ulong wq_size_waits_cnt
 
ulong mts_wq_no_underrun_cnt
 
std::atomic< longlongmts_total_wait_overlap
 
ulonglong mts_total_wait_worker_avail
 
ulong mts_wq_overfill_cnt
 
ulonglong stats_exec_time
 
ulonglong stats_read_time
 
struct timespec ts_exec [2]
 
struct timespec stats_begin
 
time_t mts_last_online_stat
 
char 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. More...
 
my_off_t new_group_master_log_pos
 
char new_group_relay_log_name [FN_REFLEN]
 
my_off_t new_group_relay_log_pos
 
enum_mts_parallel_type channel_mts_submode
 
Mts_submodecurrent_mts_submode
 
bool reported_unsafe_warning
 
bool sql_thread_kill_accepted
 
uchar slave_version_split [3]
 
bool force_flush_postponed_due_to_split_trans
 
bool m_is_engine_ha_data_detached
 
Log_eventcurrent_event
 Reference to being applied event. More...
 
bool ddl_not_atomic
 Raised when slave applies and writes to its binary log statement which is not atomic DDL and has no XID assigned. More...
 
- Public Attributes inherited from Rpl_info
mysql_mutex_t data_lock
 
mysql_mutex_t run_lock
 
mysql_mutex_t sleep_lock
 
mysql_mutex_t info_thd_lock
 
mysql_cond_t data_cond
 
mysql_cond_t start_cond
 
mysql_cond_t stop_cond
 
mysql_cond_t sleep_cond
 
PSI_mutex_keykey_info_run_lock
 
PSI_mutex_keykey_info_data_lock
 
PSI_mutex_keykey_info_sleep_lock
 
PSI_mutex_keykey_info_thd_lock
 
PSI_mutex_keykey_info_data_cond
 
PSI_mutex_keykey_info_start_cond
 
PSI_mutex_keykey_info_stop_cond
 
PSI_mutex_keykey_info_sleep_cond
 
THDinfo_thd
 
bool inited
 
std::atomic< bool > abort_slave
 
std::atomic< uintslave_running
 
std::atomic< ulong > slave_run_id
 
int events_until_exit
 
std::atomic< bool > atomic_is_stopping {false}
 
- Public Attributes inherited from Slave_reporting_capability
mysql_mutex_t err_lock
 lock used to synchronize m_last_error on 'SHOW SLAVE STATUS' 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_eventrli_description_event
 
- Protected Attributes inherited from Rpl_info
Rpl_info_handlerhandler
 Pointer to the repository's handler. More...
 
uint internal_id
 Uniquely and internally identifies an info entry (.e.g. More...
 
char channel [CHANNEL_NAME_LENGTH+1] = {0}
 Every slave info object acts on a particular channel in Multisource Replication. More...
 
- Protected Attributes inherited from Slave_reporting_capability
Error m_last_error
 Last error produced by the I/O or SQL thread respectively. More...
 

Private Member Functions

bool 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_infooperator= (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_setgtid_set
 
bool rli_fake
 
bool gtid_retrieved_initialized
 
Gtid_monitoring_infogtid_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_managercommit_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_optionuntil_option
 

Static Private Attributes

static const int LINES_IN_RELAY_LOG_INFO_WITH_DELAY = 5
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_WORKERS = 6
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_ID = 7
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_CHANNEL = 8
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_PRIV_CHECKS_USERNAME = 9
 
static const int PRIV_CHECKS_USERNAME_LENGTH = 32
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_PRIV_CHECKS_HOSTNAME = 10
 
static const int PRIV_CHECKS_HOSTNAME_LENGTH = 255
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_REQUIRE_ROW_FORMAT = 11
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_REQUIRE_TABLE_PRIMARY_KEY_CHECK = 12
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_TYPE
 
static const int LINES_IN_RELAY_LOG_INFO_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE
 
static const int MAXIMUM_LINES_IN_RELAY_LOG_INFO_FILE
 

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
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

the status of the commit timestamps for the relay log

Enumerator
COMMIT_TS_UNKNOWN 
COMMIT_TS_NOT_FOUND 
COMMIT_TS_FOUND 

◆ anonymous enum

anonymous enum
Enumerator
UNTIL_NONE 
UNTIL_MASTER_POS 
UNTIL_RELAY_POS 
UNTIL_SQL_BEFORE_GTIDS 
UNTIL_SQL_AFTER_GTIDS 
UNTIL_SQL_AFTER_MTS_GAPS 
UNTIL_SQL_VIEW_ID 
UNTIL_DONE 

◆ anonymous enum

anonymous enum
Enumerator
MTS_NOT_IN_GROUP 
MTS_IN_GROUP 
MTS_END_GROUP 
MTS_KILLED_GROUP 

◆ enum_priv_checks_status

enum class Relay_log_info::enum_priv_checks_status : int
strong

Set of possible return values for the member methods related to PRIVILEGE_CHECKS_USER management.

Enumerator
SUCCESS 

Function ended successfully.

USER_ANONYMOUS 

Value for user is anonymous (''@'...')

USERNAME_TOO_LONG 

Value for the username part of the user is larger than 32 characters.

HOSTNAME_TOO_LONG 

Value for the hostname part of the user is larger than 255 characters.

HOSTNAME_SYNTAX_ERROR 

Value for the hostname part of the user has illegal characters.

USERNAME_NULL_HOSTNAME_NOT_NULL 

Value for the username part of the user is NULL but the value for the hostname is not NULL.

USER_DOES_NOT_EXIST 

Provided user doesn't exists.

USER_DOES_NOT_HAVE_PRIVILEGES 

Provided user doesn't have the necessary privileges to execute the needed operations.

USER_DATA_CORRUPTED 

Values provided for the internal variables are corrupted.

LOAD_DATA_EVENT_NOT_ALLOWED 

Provided user doesn't have FILE privileges during the execution of a LOAD DATAevent.

◆ enum_require_row_status

enum class Relay_log_info::enum_require_row_status : int
strong
Enumerator
SUCCESS 

Function ended successfully.

PRIV_CHECKS_USER_NOT_NULL 

Value for privilege_checks_user is not empty.

◆ enum_require_table_primary_key

Identifies what is the replica policy on primary keys in tables.

Enumerator
PK_CHECK_NONE 

No policy, used on PFS.

PK_CHECK_STREAM 

The replica sets the value of sql_require_primary_key according to the source replicated value.

PK_CHECK_ON 

The replica enforces tables to have primary keys for a given channel.

PK_CHECK_OFF 

The replica does not enforce any policy around primary keys.

PK_CHECK_GENERATE 

The replica generates GIPKs for incoming keyless tables.

◆ enum_state_flag

Flags for the state of the replication.

Enumerator
IN_STMT 

The replication thread is inside a statement.

STATE_FLAGS_COUNT 

Flag counter.

Should always be last

Constructor & Destructor Documentation

◆ Relay_log_info() [1/2]

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 
)

◆ ~Relay_log_info()

Relay_log_info::~Relay_log_info ( )
override

◆ Relay_log_info() [2/2]

Relay_log_info::Relay_log_info ( const Relay_log_info info)
private

Member Function Documentation

◆ adapt_to_master_version()

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.

Parameters
fdlea pointer to new Format Description event that is being set up a new execution context.
Returns
0 when the versions are equal, master_version otherwise

◆ adapt_to_master_version_updown()

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.

Parameters
master_versionan upcoming new version
current_versionthe current version
Returns
0 when the new version is equal to the current one, master_version otherwise

◆ add_channel_to_relay_log_name()

const char * Relay_log_info::add_channel_to_relay_log_name ( char *  buff,
uint  buff_size,
const char *  base_name 
)
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.

Parameters
[in,out]buffbuffer to store the complete relay log file name
[in]buff_sizesize of buffer buff
[in]base_namethe base name of the relay log file

◆ add_gtid_set()

enum_return_status Relay_log_info::add_gtid_set ( const Gtid_set gtid_set)

Adds a GTID set to received GTID set.

Parameters
gtid_setthe gtid_set to add
Returns
RETURN_STATUS_OK or RETURN_STATUS_REPORTED_ERROR.

◆ add_logged_gtid()

void Relay_log_info::add_logged_gtid ( rpl_sidno  sidno,
rpl_gno  gno 
)
inline

◆ belongs_to_client()

bool Relay_log_info::belongs_to_client ( )
inline

◆ cached_charset_compare()

bool Relay_log_info::cached_charset_compare ( char *  charset) const

◆ cached_charset_invalidate()

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".

◆ check_applier_acl_user()

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.

Parameters
param_privilege_checks_usernamethe username part of the user.
param_privilege_checks_hostnamethe host part of the user.
Returns
a status code describing the state of the data initialization.

◆ check_if_info_was_cleared()

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.

Parameters
previous_resultthe result return from invoking the check_info method on this object.
Returns
function success state represented by the enum_return_check enumeration.

◆ check_privilege_checks_user() [1/2]

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.

Returns
a status code describing the state of the data initialization.

◆ check_privilege_checks_user() [2/2]

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.

Parameters
param_privilege_checks_usernamethe username part of the user.
param_privilege_checks_hostnamethe hostname part of the user.
Returns
a status code describing the state of the data initialization.

◆ cleanup_after_query()

void Relay_log_info::cleanup_after_query ( )
inline

◆ cleanup_after_session()

void Relay_log_info::cleanup_after_session ( )
inline

◆ cleanup_context()

void Relay_log_info::cleanup_context ( THD thd,
bool  error 
)

◆ clear_flag()

void Relay_log_info::clear_flag ( enum_state_flag  flag)
inline

Clear the value of a replication state flag.

Parameters
flagFlag to clear

◆ clear_gtid_monitoring_info()

void Relay_log_info::clear_gtid_monitoring_info ( )
inline

Clears the Gtid_monitoring_info fields.

◆ clear_info()

bool Relay_log_info::clear_info ( )

Clears from this Relay_log_info object all attribute values that are not to be kept.

Returns
true if there were a problem with clearing the data and false otherwise.

◆ clear_mts_recovery_groups()

void Relay_log_info::clear_mts_recovery_groups ( )
inline

◆ clear_privilege_checks_user()

void Relay_log_info::clear_privilege_checks_user ( )

Clears the info related to the data initialized from PRIVILEGE_CHECKS_USER.

◆ clear_processing_trx()

void Relay_log_info::clear_processing_trx ( )
inline

Clears the processing_trx structure fields.

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

◆ clear_relay_log_truncated()

void Relay_log_info::clear_relay_log_truncated ( )

Applier clears the flag after it handled the situation.

The caller must hold data_lock.

◆ clear_sql_delay()

void Relay_log_info::clear_sql_delay ( )
inline

Reset the delay.

This is used by RESET SLAVE to clear the delay.

◆ clear_tables_to_lock()

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.

◆ clear_until_option()

void Relay_log_info::clear_until_option ( )
inline

◆ close_temporary_tables()

void Relay_log_info::close_temporary_tables ( )

◆ commit_positions()

bool Relay_log_info::commit_positions ( )
virtual

The method implements updating a slave info table.

It's specialized differently for STS and MTS.

Reimplemented in Slave_worker.

◆ count_relay_log_space()

int Relay_log_info::count_relay_log_space ( )

◆ deinit_workers()

void Relay_log_info::deinit_workers ( )

The method to invoke at slave threads stop.

◆ detach_engine_ha_data()

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.

Parameters
thda reference to THD

◆ end_info()

void Relay_log_info::end_info ( )

◆ fill_coord_err_buf()

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

Parameters
[in]levelspecifies the level- error, warning or information,
[in]err_codeerror number,
[in]buff_coorderror message to be used.

◆ finished_processing()

void Relay_log_info::finished_processing ( )
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.

◆ flush_current_log()

int Relay_log_info::flush_current_log ( )

◆ flush_info()

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:

  • As this is only called by the slave thread or on STOP SLAVE, with the log_lock grabbed and the slave thread stopped, we don't need to have a lock here.
  • If there is an active transaction, then we don't update the position in the relay log. This is to ensure that we re-execute statements if we die in the middle of an transaction that was rolled back.
  • As a transaction never spans binary logs, we don't have to handle the case where we do a relay-log-rotation in the middle of the transaction. If this would not be the case, we would have to ensure that we don't delete the relay log file where the transaction started when we switch to a new relay log file.
Return values
0ok,
1write error, otherwise. Store the file and position where the slave's SQL thread are in the relay log.

Notes:

  • This function should be called either from the slave SQL thread, or when the slave thread is not running. (It reads the group_{relay|master}_log_{pos|name} and delay fields in the rli object. These may only be modified by the slave SQL thread or by a client thread when the slave SQL thread is not running.)
  • If there is an active transaction, then we do not update the position in the relay log. This is to ensure that we re-execute statements if we die in the middle of an transaction that was rolled back.
  • As a transaction never spans binary logs, we don't have to handle the case where we do a relay-log-rotation in the middle of the transaction. If transactions could span several binlogs, we would have to ensure that we do not delete the relay log file where the transaction started before switching to a new relay log file.
  • Error can happen if writing to file fails or if flushing the file fails.
Parameters
flush_flagsa 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
Returns
0 on success, 1 on error.

◆ get_allow_drop_write_set()

bool Relay_log_info::get_allow_drop_write_set ( )
inline

◆ get_c_rli()

virtual Relay_log_info * Relay_log_info::get_c_rli ( )
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.

◆ get_commit_order_manager()

Commit_order_manager * Relay_log_info::get_commit_order_manager ( )
inline

◆ get_event_relay_log_name()

const char * Relay_log_info::get_event_relay_log_name ( )
inline

◆ get_event_relay_log_pos()

ulonglong Relay_log_info::get_event_relay_log_pos ( )
inline

◆ get_event_start_pos()

my_off_t Relay_log_info::get_event_start_pos ( )
inline

◆ get_flag()

bool Relay_log_info::get_flag ( enum_state_flag  flag)
inline

Get the value of a replication state flag.

Parameters
flagFlag to get value of
Returns
true if the flag was set, false otherwise.

◆ get_for_channel_str()

const char * Relay_log_info::get_for_channel_str ( bool  upper_case = false) const
overridevirtual

Implements Slave_reporting_capability.

Reimplemented in Slave_worker.

◆ get_future_event_relay_log_pos()

ulonglong Relay_log_info::get_future_event_relay_log_pos ( )
inline

◆ get_group_master_log_name()

const char * Relay_log_info::get_group_master_log_name ( ) const
inline

◆ get_group_master_log_name_info()

const char * Relay_log_info::get_group_master_log_name_info ( ) const
inline

◆ get_group_master_log_pos()

ulonglong Relay_log_info::get_group_master_log_pos ( ) const
inline

◆ get_group_master_log_pos_info()

ulonglong Relay_log_info::get_group_master_log_pos_info ( ) const
inline

◆ get_group_relay_log_name()

const char * Relay_log_info::get_group_relay_log_name ( )
inline

◆ get_group_relay_log_pos()

ulonglong Relay_log_info::get_group_relay_log_pos ( )
inline

◆ get_group_source_log_start_end_pos()

std::tuple< ulonglong, ulonglong > Relay_log_info::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.

Returns
source event group start and end position in binary log

◆ get_gtid_monitoring_info()

Gtid_monitoring_info * Relay_log_info::get_gtid_monitoring_info ( )
inline
Returns
the pointer to the Gtid_monitoring_info.

◆ get_gtid_set()

const Gtid_set * Relay_log_info::get_gtid_set ( ) const
inline

◆ get_ignore_write_set_memory_limit()

bool Relay_log_info::get_ignore_write_set_memory_limit ( )
inline

◆ get_number_info_rli_fields()

size_t Relay_log_info::get_number_info_rli_fields ( )
static

◆ get_privilege_checks_hostname()

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.

Returns
a string holding the host part of the user or an empty string.

◆ get_privilege_checks_username()

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.

Returns
a string holding the username part of the user or an empty string.

◆ get_require_table_primary_key_check()

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.

Returns
STREAM if it replicates the source values, ON if it enforces the need on primary keys, OFF if it does no enforce any restrictions, GENERATE if a GIPK is added to the table.

◆ get_rli_description_event()

Format_description_log_event * Relay_log_info::get_rli_description_event ( ) const
inline

Return the current Format_description_log_event.

◆ get_row_stmt_start_timestamp()

time_t Relay_log_info::get_row_stmt_start_timestamp ( )
inline

◆ get_rpl_log_name()

const char * Relay_log_info::get_rpl_log_name ( ) const
inline

◆ get_sid_lock()

Checkable_rwlock * Relay_log_info::get_sid_lock ( )
inline

◆ get_sid_map()

Sid_map * Relay_log_info::get_sid_map ( )
inline

◆ get_sql_delay()

time_t Relay_log_info::get_sql_delay ( )
inline

◆ get_sql_delay_end()

time_t Relay_log_info::get_sql_delay_end ( )
inline

◆ get_table_data()

bool Relay_log_info::get_table_data ( TABLE table_arg,
table_def **  tabledef_var,
TABLE **  conv_table_var 
) const
inline

◆ get_thd_tx_priority()

int Relay_log_info::get_thd_tx_priority ( )
inline

◆ get_until_log_name()

const char * Relay_log_info::get_until_log_name ( )

◆ get_until_log_pos()

my_off_t Relay_log_info::get_until_log_pos ( )

◆ get_worker()

Slave_worker * Relay_log_info::get_worker ( size_t  n)
inline

◆ get_worker_count()

size_t Relay_log_info::get_worker_count ( )
inline

◆ inc_event_relay_log_pos()

void Relay_log_info::inc_event_relay_log_pos ( )
inline

◆ inc_group_relay_log_pos()

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.

Parameters
log_posa value of the executed position to update to
need_data_lockwhether data_lock should be acquired
forcethe value is passed to eventual flush_info()

◆ init_until_option()

int Relay_log_info::init_until_option ( THD thd,
const LEX_MASTER_INFO master_param 
)

Initialize until option object when starting slave.

Parameters
[in]thdThe thread object of current session.
[in]master_paramthe parameters of START SLAVE.
Returns
int
Return values
0Succeeds to initialize until option object.
<>0 A defined error number is return if any error happens.

◆ init_workers()

void Relay_log_info::init_workers ( ulong  n_workers)

The method to invoke at slave threads start.

◆ initialize_applier_security_context()

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.

Returns
a status code describing the state of the data initialization.

◆ initialize_security_context()

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.

Returns
a status code describing the state of the data initialization.

◆ is_applier_source_position_info_invalid()

bool Relay_log_info::is_applier_source_position_info_invalid ( ) const

Returns if the applier positions are marked as being invalid or not.

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

◆ is_engine_ha_data_detached()

bool Relay_log_info::is_engine_ha_data_detached ( )
inline

Checks whether engine ha data is detached from THD.

Return values
trueif the data is detached
falseif the data is not detached

◆ is_group_relay_log_name_invalid()

bool Relay_log_info::is_group_relay_log_name_invalid ( const char **  errmsg)

Check if group_relay_log_name is in index file.

Parameters
[out]errmsgAn error message is returned if error happens.
Return values
falseIt is valid.
trueIt is invalid. In this case, *errmsg is set to point to the error message.

◆ is_in_group()

bool Relay_log_info::is_in_group ( ) const
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:

  • If the master generates Gtid events (5.7.5 or later, or 5.6 or later with GTID_MODE=ON), then is_in_group is the same as info_thd->owned_gtid.sidno != 0, since owned_gtid.sidno is set to non-zero by the Gtid_log_event and cleared to zero at commit or rollback.
  • If the master does not generate Gtid events (i.e., master is pre-5.6, or pre-5.7.5 with GTID_MODE=OFF), then is_in_group is the same as is_in_trx_or_stmt().
Return values
trueReplication thread is inside a group.
falseReplication thread is not inside a group.

◆ is_in_stmt()

bool Relay_log_info::is_in_stmt ( ) const
inlineprivate

Auxiliary function used by is_in_group.

The execute thread is in the middle of a statement in the following cases:

  • User_var/Intvar/Rand events have been processed, but the corresponding Query_log_event has not been processed.
  • Table_map or Row events have been processed, and the last Row event did not have the STMT_END_F set.
Return values
trueReplication thread is inside a statement.
falseReplication thread is not inside a statement.

◆ is_in_trx_or_stmt()

bool Relay_log_info::is_in_trx_or_stmt ( ) const
inlineprivate

Auxiliary function used by is_in_group.

Return values
trueThe 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.
falseThe execute thread thread is not inside a statement or a transaction.

◆ is_long_find_row_note_printed()

bool Relay_log_info::is_long_find_row_note_printed ( )
inline

◆ is_mts_in_group()

bool Relay_log_info::is_mts_in_group ( )
inline

returns true if Coordinator is scheduling events belonging to the same group and has not reached yet its terminal event.

◆ is_mts_recovery()

bool Relay_log_info::is_mts_recovery ( ) const
inline

returns true if there is any gap-group of events to execute at slave starting phase.

◆ is_parallel_exec()

bool Relay_log_info::is_parallel_exec ( ) const
inline

returns true if events are to be executed in parallel

◆ is_privilege_checks_user_corrupted()

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.

Returns
true if the data is corrupted, false otherwise.

◆ is_privilege_checks_user_null()

bool Relay_log_info::is_privilege_checks_user_null ( ) const

Returns whether or not there is no user configured for PRIVILEGE_CHECKS_USER.

Returns
true if there is no user configured for PRIVILEGE_CHECKS_USER and false otherwise.

◆ is_processing_trx()

bool Relay_log_info::is_processing_trx ( )
inline
Returns
True if there is a transaction being currently processed

◆ is_relay_log_truncated()

bool Relay_log_info::is_relay_log_truncated ( )
inline

◆ is_row_format_required()

bool Relay_log_info::is_row_format_required ( ) const

Returns whether the slave is running in row mode only.

Returns
true if row_format_required is active, false otherwise.

◆ is_time_for_mta_checkpoint()

bool Relay_log_info::is_time_for_mta_checkpoint ( )

Check if it is time to compute MTS checkpoint.

Return values
trueIt is time to compute MTS checkpoint.
falseIt is not MTS or it is not time for computing checkpoint.

◆ is_until_satisfied_after_dispatching_event()

bool Relay_log_info::is_until_satisfied_after_dispatching_event ( )
inline

◆ is_until_satisfied_at_start_slave()

bool Relay_log_info::is_until_satisfied_at_start_slave ( )
inline

◆ is_until_satisfied_before_dispatching_event()

bool Relay_log_info::is_until_satisfied_before_dispatching_event ( const Log_event ev)
inline

◆ mts_finalize_recovery()

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.

Returns
false on success true when reset_notified_checkpoint failed.

◆ notify_group_master_log_name_update()

void Relay_log_info::notify_group_master_log_name_update ( )
inline

The same as notify_group_relay_log_name_update but for group_master_log_name.

◆ notify_relay_log_change()

void Relay_log_info::notify_relay_log_change ( )
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.

◆ notify_relay_log_truncated()

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.

◆ operator=()

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

◆ post_commit()

void Relay_log_info::post_commit ( bool  on_rollback)
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.

Parameters
on_rollbackwhen true the method carries out rollback action

Reimplemented in Slave_worker.

◆ post_rollback()

void Relay_log_info::post_rollback ( )
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.

◆ pre_commit()

bool Relay_log_info::pre_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.

Returns
false as success, otherwise true

◆ print_applier_security_context_user_host()

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.

Returns
an std::pair containing the username and the hostname printable representations.

◆ purge_relay_logs()

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.

Parameters
[in]thdconnection,
[out]errmsgstore pointer to an error message.
[in]delete_onlyIf true, do not start writing to a new log file.
Return values
0successfully executed,
1otherwise error, where errmsg is set to point to the error message.

Clear the retrieved gtid set for this channel.

◆ read_info()

bool Relay_log_info::read_info ( Rpl_info_handler from)
overrideprivatevirtual

Implements Rpl_info.

Reimplemented in Slave_worker.

◆ reattach_engine_ha_data()

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.

Parameters
thda reference to THD

◆ reinit_sql_thread_io_cache()

bool Relay_log_info::reinit_sql_thread_io_cache ( const char *  log,
bool  need_data_lock 
)

◆ report_privilege_check_error()

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.

Parameters
levelthe message urgency level, e.g., ERROR_LEVEL, WARNING_LEVEL, etc.
status_codethe status code to output the associated error message for.
to_clienta flag indicating if the message should be sent to the client session or to the server log.
channel_namename of the channel for which the error is being reported.
user_nameusername for which the error is being reported.
host_namehostname for which the error is being reported.

◆ reset_group_relay_log_pos()

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.

Parameters
[out]errmsgAn error message is set into it if error happens.
Return values
falseSuccess
trueError

◆ reset_notified_checkpoint()

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_master timestamp is installed.

Parameters
shiftnumber of bits to shift by Worker due to the current checkpoint change.
new_tsnew seconds_behind_master timestamp value unless zero. Zero could be due to FD event or fake rotate event.
update_timestampif true, this function will update the rli->last_master_timestamp.

◆ reset_notified_relay_log_change()

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().

◆ reset_row_stmt_start_timestamp()

void Relay_log_info::reset_row_stmt_start_timestamp ( )
inline

◆ retried_processing()

void Relay_log_info::retried_processing ( uint  transient_errno_arg,
const char *  transient_err_message_arg,
ulong  trans_retries_arg 
)
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.

Parameters
transient_errno_argTransient error number.
transient_err_message_argTransient error message.
trans_retries_argNumber of times this transaction has been retried so far.

◆ rli_init_info()

int Relay_log_info::rli_init_info ( bool  skip_received_gtid_set_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 master process and the change master 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.

Parameters
skip_received_gtid_set_recoveryWhen true, skips the received GTID set recovery.
Return values
0Success.
1Error.

◆ set_allow_drop_write_set()

void Relay_log_info::set_allow_drop_write_set ( bool  does_not_require_ws)
inline

◆ set_applier_source_position_info_invalid()

void Relay_log_info::set_applier_source_position_info_invalid ( bool  invalid)

Marks the applier position information as being invalid or not.

Parameters
invalidvalue to set the position/file info as invalid or not

◆ set_commit_order_manager()

void Relay_log_info::set_commit_order_manager ( Commit_order_manager mngr)
inline

◆ set_event_relay_log_name()

void Relay_log_info::set_event_relay_log_name ( const char *  log_file_name)
inline

◆ set_event_relay_log_pos()

void Relay_log_info::set_event_relay_log_pos ( ulonglong  log_pos)
inline

◆ set_event_start_pos()

void Relay_log_info::set_event_start_pos ( my_off_t  pos)
inline

◆ set_filter()

void Relay_log_info::set_filter ( Rpl_filter channel_filter)
inline

Set replication filter for the channel.

◆ set_flag()

void Relay_log_info::set_flag ( enum_state_flag  flag)
inline

Set the value of a replication state flag.

Parameters
flagFlag to set

◆ set_future_event_relay_log_pos()

void Relay_log_info::set_future_event_relay_log_pos ( ulonglong  log_pos)
inline

◆ set_group_master_log_name()

void Relay_log_info::set_group_master_log_name ( const char *  log_file_name)
inline

◆ set_group_master_log_pos()

void Relay_log_info::set_group_master_log_pos ( ulonglong  log_pos)
inline

◆ set_group_relay_log_name() [1/2]

void Relay_log_info::set_group_relay_log_name ( const char *  log_file_name)
inline

◆ set_group_relay_log_name() [2/2]

void Relay_log_info::set_group_relay_log_name ( const char *  log_file_name,
size_t  len 
)
inline

◆ set_group_relay_log_pos()

void Relay_log_info::set_group_relay_log_pos ( ulonglong  log_pos)
inline

◆ set_group_source_log_start_end_pos()

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.

Parameters
ev- event within a group (including first and last)

◆ set_ignore_write_set_memory_limit()

void Relay_log_info::set_ignore_write_set_memory_limit ( bool  ignore_limit)
inline

◆ set_info_search_keys()

bool Relay_log_info::set_info_search_keys ( Rpl_info_handler to)
overridevirtual

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

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

Currently, used only for TABLE repository.

Implements Rpl_info.

Reimplemented in Slave_worker.

◆ set_long_find_row_note_printed()

void Relay_log_info::set_long_find_row_note_printed ( )
inline

◆ set_master_info()

void Relay_log_info::set_master_info ( Master_info info)

◆ set_nullable_fields()

void Relay_log_info::set_nullable_fields ( MY_BITMAP nullable_fields)
static

Sets bits for columns that are allowed to be NULL.

Parameters
nullable_fieldsthe bitmap to hold the nullable fields.

◆ set_privilege_checks_user()

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.

Parameters
param_privilege_checks_usernamethe username part of the user.
param_privilege_checks_hostnamethe hostname part of the user.
Returns
a status code describing the state of the data initialization.

◆ set_privilege_checks_user_corrupted()

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.

Parameters
is_corruptedthe flag value.

◆ set_require_row_format()

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.

Parameters
require_rowthe flag value.

◆ set_require_table_primary_key_check()

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.

Parameters
require_pkthe policy value.

◆ set_rli_description_event()

int Relay_log_info::set_rli_description_event ( Format_description_log_event fe)
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.

Returns
1 if an error was encountered, 0 otherwise.

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.

Parameters
fePointer to be installed into execution context FormatDescriptor event
Returns
1 if an error was encountered, 0 otherwise.

Reimplemented in Slave_worker.

◆ set_row_stmt_start_timestamp()

time_t Relay_log_info::set_row_stmt_start_timestamp ( )
inline

◆ set_sql_delay()

void Relay_log_info::set_sql_delay ( time_t  _sql_delay)
inline

◆ set_thd_tx_priority()

void Relay_log_info::set_thd_tx_priority ( int  priority)
inline

◆ set_until_option()

void Relay_log_info::set_until_option ( Until_option option)
inline

◆ slave_close_thread_tables()

void Relay_log_info::slave_close_thread_tables ( THD thd)

◆ start_sql_delay()

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 SLAVE STATUS and SHOW PROCESSLIST.

Requires rli->data_lock.

Parameters
delay_endThe time when the delay shall end.

◆ started_processing() [1/2]

void Relay_log_info::started_processing ( Gtid  gtid_arg,
ulonglong  original_ts_arg,
ulonglong  immediate_ts_arg,
bool  skipped = false 
)
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.

Parameters
gtid_argthe gtid of the trx
original_ts_argthe original commit timestamp of the transaction
immediate_ts_argthe immediate commit timestamp of the transaction
skippedtrue if the transaction was gtid skipped

◆ started_processing() [2/2]

void Relay_log_info::started_processing ( Gtid_log_event gtid_log_ev_arg)
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.

Parameters
gtid_log_ev_argthe gtid log event of the trx

◆ stmt_done()

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.

Parameters
event_log_posMaster log position of the event. The position is recorded in the relay log info and used to produce information for SHOW SLAVE STATUS.

◆ unset_long_find_row_note_printed()

void Relay_log_info::unset_long_find_row_note_printed ( )
inline

◆ wait_for_gtid_set() [1/3]

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.

Parameters
thdThe thread for status changes and kill status
gtidA char array with a GTID set
timeoutNumber of seconds to wait before timing out
update_THD_statusShall the method update the THD stage
Return values
0The set is already executed
-1There was a timeout waiting for the set
-2There was an issue while waiting.

◆ wait_for_gtid_set() [2/3]

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.

Parameters
thdThe thread for status changes and kill status
wait_gtid_setA GTID_set object
timeoutNumber of seconds to wait before timing out
update_THD_statusShall the method update the THD stage
Return values
0The set is already executed
-1There was a timeout waiting for the set
-2There was an issue while waiting.

◆ wait_for_gtid_set() [3/3]

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.

Parameters
thdThe thread for status changes and kill status
gtidA String with a GTID set
timeoutNumber of seconds to wait before timing out
update_THD_statusShall the method update the THD stage
Return values
0The set is already executed
-1There was a timeout waiting for the set
-2There was an issue while waiting.

◆ wait_for_pos()

int Relay_log_info::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.

SYNOPSIS

Parameters
[in]thdclient thread that sent SELECT SOURCE_POS_WAIT,
[in]log_namelog name to wait for,
[in]log_posposition to wait for,
[in]timeouttimeout 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.
Return values
-2improper 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,
-1timed out
>=0number of log events the function had to wait before reaching the desired log/position

◆ write_info()

bool Relay_log_info::write_info ( Rpl_info_handler to)
overrideprivatevirtual

Implements Rpl_info.

Reimplemented in Slave_worker.

Friends And Related Function Documentation

◆ Rpl_info_factory

friend class Rpl_info_factory
friend

Member Data Documentation

◆ abort_pos_wait

volatile ulong Relay_log_info::abort_pos_wait

◆ atomic_channel_open_temp_tables

std::atomic<int32> Relay_log_info::atomic_channel_open_temp_tables {0}

◆ cached_charset

char Relay_log_info::cached_charset[6]

◆ channel_mts_submode

enum_mts_parallel_type Relay_log_info::channel_mts_submode

◆ checkpoint_group

uint Relay_log_info::checkpoint_group

◆ commit_order_mngr

Commit_order_manager* Relay_log_info::commit_order_mngr
private

◆ 

enum { ... } Relay_log_info::commit_timestamps_status

the status of the commit timestamps for the relay log

◆ coordinator_log_after_purge

std::string Relay_log_info::coordinator_log_after_purge {""}

◆ curr_group_assigned_parts

Prealloced_array<db_worker_hash_entry *, 4> Relay_log_info::curr_group_assigned_parts

◆ curr_group_da

Prealloced_array<Slave_job_item, 8> Relay_log_info::curr_group_da

◆ curr_group_isolated

bool Relay_log_info::curr_group_isolated

◆ curr_group_seen_begin

bool Relay_log_info::curr_group_seen_begin

◆ curr_group_seen_gtid

bool Relay_log_info::curr_group_seen_gtid

◆ current_event

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.

◆ current_mts_submode

Mts_submode* Relay_log_info::current_mts_submode

◆ ddl_not_atomic

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_events

Deferred_log_events* Relay_log_info::deferred_events

◆ deferred_events_collecting

bool Relay_log_info::deferred_events_collecting

◆ error_on_rli_init_info

bool Relay_log_info::error_on_rli_init_info

◆ event_relay_log_name

char Relay_log_info::event_relay_log_name[FN_REFLEN]
protected

◆ event_relay_log_pos

ulonglong Relay_log_info::event_relay_log_pos
protected

◆ event_start_pos

my_off_t Relay_log_info::event_start_pos
protected

◆ exit_count_lock

mysql_mutex_t Relay_log_info::exit_count_lock

◆ exit_counter

ulong Relay_log_info::exit_counter

◆ force_flush_postponed_due_to_split_trans

bool Relay_log_info::force_flush_postponed_due_to_split_trans

◆ future_event_relay_log_pos

ulonglong Relay_log_info::future_event_relay_log_pos
protected

◆ gaq

Slave_committed_queue* Relay_log_info::gaq

◆ group_master_log_name

char Relay_log_info::group_master_log_name[FN_REFLEN]
protected

◆ group_master_log_pos

volatile my_off_t Relay_log_info::group_master_log_pos
protected

◆ group_relay_log_name

char Relay_log_info::group_relay_log_name[FN_REFLEN]
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.

◆ group_relay_log_pos

ulonglong Relay_log_info::group_relay_log_pos
protected

◆ group_source_log_end_pos

ulonglong Relay_log_info::group_source_log_end_pos
private
See also
set_group_source_log_start_end_pos, get_group_source_log_start_end_pos

◆ group_source_log_seen_start_pos

bool Relay_log_info::group_source_log_seen_start_pos
private

Event group beginning event has been seen.

Event group may begin with two events marked as beginning.

See also
set_group_source_log_start_end_pos

◆ group_source_log_start_pos

ulonglong Relay_log_info::group_source_log_start_pos
private
See also
set_group_source_log_start_end_pos, get_group_source_log_start_end_pos

◆ gtid_monitoring_info

Gtid_monitoring_info* Relay_log_info::gtid_monitoring_info
private

Stores information on the last processed transaction or the transaction that is currently being processed.

STS:

  • timestamps of the currently applying/last applied transaction

MTS:

  • coordinator thread: timestamps of the currently scheduling/last scheduled transaction in a worker's queue
  • worker thread: timestamps of the currently applying/last applied transaction

◆ gtid_retrieved_initialized

bool Relay_log_info::gtid_retrieved_initialized
private

◆ gtid_set

Gtid_set* Relay_log_info::gtid_set
private

◆ ign_master_log_name_end

char Relay_log_info::ign_master_log_name_end[FN_REFLEN]

◆ ign_master_log_pos_end

ulonglong Relay_log_info::ign_master_log_pos_end

◆ inited_hash_workers

bool Relay_log_info::inited_hash_workers

◆ is_group_master_log_pos_invalid

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 MASTER 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

◆ is_receiver_waiting_for_rl_space

std::atomic_bool Relay_log_info::is_receiver_waiting_for_rl_space

◆ is_relay_log_recovery

bool Relay_log_info::is_relay_log_recovery

◆ last_assigned_worker

Slave_worker* Relay_log_info::last_assigned_worker

◆ last_clock

struct timespec Relay_log_info::last_clock

Identifies the last time a checkpoint routine has been executed.

◆ last_event_start_time

time_t Relay_log_info::last_event_start_time

◆ last_master_timestamp

time_t Relay_log_info::last_master_timestamp

◆ LINES_IN_RELAY_LOG_INFO_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_TYPE

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_TYPE
staticprivate
Initial value:
=
13

◆ LINES_IN_RELAY_LOG_INFO_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE
staticprivate
Initial value:
=
14

◆ LINES_IN_RELAY_LOG_INFO_WITH_CHANNEL

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_CHANNEL = 8
staticprivate

◆ LINES_IN_RELAY_LOG_INFO_WITH_DELAY

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_DELAY = 5
staticprivate

◆ LINES_IN_RELAY_LOG_INFO_WITH_ID

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_ID = 7
staticprivate

◆ LINES_IN_RELAY_LOG_INFO_WITH_PRIV_CHECKS_HOSTNAME

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_PRIV_CHECKS_HOSTNAME = 10
staticprivate

◆ LINES_IN_RELAY_LOG_INFO_WITH_PRIV_CHECKS_USERNAME

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_PRIV_CHECKS_USERNAME = 9
staticprivate

◆ LINES_IN_RELAY_LOG_INFO_WITH_REQUIRE_ROW_FORMAT

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_REQUIRE_ROW_FORMAT = 11
staticprivate

◆ LINES_IN_RELAY_LOG_INFO_WITH_REQUIRE_TABLE_PRIMARY_KEY_CHECK

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_REQUIRE_TABLE_PRIMARY_KEY_CHECK = 12
staticprivate

◆ LINES_IN_RELAY_LOG_INFO_WITH_WORKERS

const int Relay_log_info::LINES_IN_RELAY_LOG_INFO_WITH_WORKERS = 6
staticprivate

◆ log_space_cond

mysql_cond_t Relay_log_info::log_space_cond

◆ log_space_limit

std::atomic<ulonglong> Relay_log_info::log_space_limit

◆ log_space_lock

mysql_mutex_t Relay_log_info::log_space_lock

◆ log_space_total

std::atomic<ulonglong> Relay_log_info::log_space_total

◆ logical_clock_cond

mysql_cond_t Relay_log_info::logical_clock_cond

◆ long_find_row_note_printed

bool Relay_log_info::long_find_row_note_printed
private

◆ m_allow_drop_write_set

bool Relay_log_info::m_allow_drop_write_set
private

Even if a component says all transactions require write sets, this variable says the SQL thread transactions can drop them.

◆ m_assign_gtids_to_anonymous_transactions_info

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 MASTER.

◆ m_flags

uint32 Relay_log_info::m_flags
private

◆ m_ignore_write_set_memory_limit

bool Relay_log_info::m_ignore_write_set_memory_limit
private

If the SQL thread should or not ignore the set limit for write set collection.

◆ m_is_applier_source_position_info_invalid

bool Relay_log_info::m_is_applier_source_position_info_invalid
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

◆ m_is_engine_ha_data_detached

bool Relay_log_info::m_is_engine_ha_data_detached

◆ m_key_mta_temp_table_LOCK

PSI_mutex_key Relay_log_info::m_key_mta_temp_table_LOCK

◆ m_privilege_checks_hostname

std::string Relay_log_info::m_privilege_checks_hostname
private

The host name part of the user passed on to PRIVILEGE_CHECKS_USER.

◆ m_privilege_checks_user_corrupted

bool Relay_log_info::m_privilege_checks_user_corrupted
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.

◆ m_privilege_checks_username

std::string Relay_log_info::m_privilege_checks_username
private

The user name part of the user passed on to PRIVILEGE_CHECKS_USER.

◆ m_relay_log_truncated

bool Relay_log_info::m_relay_log_truncated = false
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.

◆ m_require_row_format

bool Relay_log_info::m_require_row_format
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

◆ m_require_table_primary_key_check

enum_require_table_primary_key Relay_log_info::m_require_table_primary_key_check
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.

◆ m_table_map

table_mapping Relay_log_info::m_table_map

◆ mapping_db_to_worker

◆ max_updated_index

ulonglong Relay_log_info::max_updated_index

◆ MAXIMUM_LINES_IN_RELAY_LOG_INFO_FILE

const int Relay_log_info::MAXIMUM_LINES_IN_RELAY_LOG_INFO_FILE
staticprivate
Initial value:
=
static const int LINES_IN_RELAY_LOG_INFO_WITH_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE
Definition: rpl_rli.h:1927

◆ mi

Master_info* Relay_log_info::mi

◆ mts_coordinator_basic_nap

ulong Relay_log_info::mts_coordinator_basic_nap

◆ mts_end_group_sets_max_dbs

bool Relay_log_info::mts_end_group_sets_max_dbs

◆ mts_events_assigned

ulonglong Relay_log_info::mts_events_assigned

◆ mts_gaq_LOCK

mysql_mutex_t Relay_log_info::mts_gaq_LOCK

◆ 

enum { ... } Relay_log_info::mts_group_status

◆ mts_groups_assigned

ulonglong Relay_log_info::mts_groups_assigned

◆ mts_last_online_stat

time_t Relay_log_info::mts_last_online_stat

◆ mts_pending_jobs_size

ulonglong Relay_log_info::mts_pending_jobs_size

◆ mts_pending_jobs_size_max

ulonglong Relay_log_info::mts_pending_jobs_size_max

◆ mts_recovery_group_cnt

ulong Relay_log_info::mts_recovery_group_cnt

◆ mts_recovery_group_seen_begin

bool Relay_log_info::mts_recovery_group_seen_begin

◆ mts_recovery_index

ulong Relay_log_info::mts_recovery_index

◆ mts_slave_worker_queue_len_max

ulong Relay_log_info::mts_slave_worker_queue_len_max

◆ mts_temp_table_LOCK

mysql_mutex_t Relay_log_info::mts_temp_table_LOCK

◆ mts_total_wait_overlap

std::atomic<longlong> Relay_log_info::mts_total_wait_overlap

◆ mts_total_wait_worker_avail

ulonglong Relay_log_info::mts_total_wait_worker_avail

◆ mts_worker_underrun_level

long Relay_log_info::mts_worker_underrun_level

◆ mts_wq_excess_cnt

volatile long Relay_log_info::mts_wq_excess_cnt

◆ mts_wq_no_underrun_cnt

ulong Relay_log_info::mts_wq_no_underrun_cnt

◆ mts_wq_overfill_cnt

ulong Relay_log_info::mts_wq_overfill_cnt

◆ mts_wq_overrun_cnt

volatile ulong Relay_log_info::mts_wq_overrun_cnt

◆ mts_wq_oversize

bool Relay_log_info::mts_wq_oversize

◆ mts_wq_underrun_w_id

volatile ulong Relay_log_info::mts_wq_underrun_w_id

◆ new_group_master_log_name

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.

◆ new_group_master_log_pos

my_off_t Relay_log_info::new_group_master_log_pos

◆ new_group_relay_log_name

char Relay_log_info::new_group_relay_log_name[FN_REFLEN]

◆ new_group_relay_log_pos

my_off_t Relay_log_info::new_group_relay_log_pos

◆ opt_replica_parallel_workers

ulong Relay_log_info::opt_replica_parallel_workers

◆ original_commit_timestamp

uint64 Relay_log_info::original_commit_timestamp

◆ pending_jobs

volatile ulong Relay_log_info::pending_jobs

◆ pending_jobs_cond

mysql_cond_t Relay_log_info::pending_jobs_cond

◆ pending_jobs_lock

mysql_mutex_t Relay_log_info::pending_jobs_lock

◆ PRIV_CHECKS_HOSTNAME_LENGTH

const int Relay_log_info::PRIV_CHECKS_HOSTNAME_LENGTH = 255
staticprivate

◆ PRIV_CHECKS_USERNAME_LENGTH

const int Relay_log_info::PRIV_CHECKS_USERNAME_LENGTH = 32
staticprivate

◆ recovery_groups

MY_BITMAP Relay_log_info::recovery_groups

◆ recovery_groups_inited

bool Relay_log_info::recovery_groups_inited

◆ recovery_parallel_workers

ulong Relay_log_info::recovery_parallel_workers

◆ relay_log

MYSQL_BIN_LOG Relay_log_info::relay_log

◆ replica_parallel_workers

ulong Relay_log_info::replica_parallel_workers

◆ replicate_same_server_id

bool Relay_log_info::replicate_same_server_id

◆ reported_unsafe_warning

bool Relay_log_info::reported_unsafe_warning

◆ retried_trans

ulong Relay_log_info::retried_trans

◆ rli_checkpoint_seqno

uint Relay_log_info::rli_checkpoint_seqno

◆ rli_description_event

Format_description_log_event* Relay_log_info::rli_description_event
protected

◆ rli_fake

bool Relay_log_info::rli_fake
private

◆ RLI_FLUSH_IGNORE_GTID_ONLY

constexpr int Relay_log_info::RLI_FLUSH_IGNORE_GTID_ONLY {1 << 1}
staticconstexpr

Flush disresgarding the value of GTID_ONLY.

◆ RLI_FLUSH_IGNORE_SYNC_OPT

constexpr int Relay_log_info::RLI_FLUSH_IGNORE_SYNC_OPT {1 << 0}
staticconstexpr

Ignore server sync options and flush.

◆ RLI_FLUSH_NO_OPTION

constexpr int Relay_log_info::RLI_FLUSH_NO_OPTION {0}
staticconstexpr

No flush options given to relay log flush.

◆ row_stmt_start_timestamp

time_t Relay_log_info::row_stmt_start_timestamp
private

◆ rows_query_ev

Rows_query_log_event* Relay_log_info::rows_query_ev

◆ rpl_filter

Rpl_filter* Relay_log_info::rpl_filter

◆ save_temporary_tables

TABLE* Relay_log_info::save_temporary_tables

◆ slave_patternload_file

char Relay_log_info::slave_patternload_file[FN_REFLEN]

◆ slave_patternload_file_size

size_t Relay_log_info::slave_patternload_file_size

◆ slave_skip_counter

volatile uint32 Relay_log_info::slave_skip_counter

◆ slave_version_split

uchar Relay_log_info::slave_version_split[3]

◆ slave_worker_hash_cond

mysql_cond_t Relay_log_info::slave_worker_hash_cond

◆ slave_worker_hash_lock

mysql_mutex_t Relay_log_info::slave_worker_hash_lock

◆ sql_delay

time_t Relay_log_info::sql_delay
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 MASTER TO MASTER_DELAY=X.

Guarded by data_lock. Initialized by the client thread executing START SLAVE. Written by client threads executing CHANGE MASTER TO MASTER_DELAY=X. Read by SQL thread and by client threads executing SHOW SLAVE 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().

◆ sql_delay_end

time_t Relay_log_info::sql_delay_end
private

During a delay, specifies the point in time when the delay ends.

This is used for the SQL_Remaining_Delay column in SHOW SLAVE STATUS.

Guarded by data_lock. Written by the sql thread. Read by client threads executing SHOW SLAVE STATUS.

◆ sql_thread_kill_accepted

bool Relay_log_info::sql_thread_kill_accepted

◆ stats_begin

struct timespec Relay_log_info::stats_begin

◆ stats_exec_time

ulonglong Relay_log_info::stats_exec_time

◆ stats_read_time

ulonglong Relay_log_info::stats_read_time

◆ tables_to_lock

RPL_Table_ref* Relay_log_info::tables_to_lock

◆ tables_to_lock_count

uint Relay_log_info::tables_to_lock_count

◆ thd_tx_priority

int Relay_log_info::thd_tx_priority
private

◆ trans_retries

ulong Relay_log_info::trans_retries

◆ transaction_parser

Replication_transaction_boundary_parser Relay_log_info::transaction_parser

◆ ts_exec

struct timespec Relay_log_info::ts_exec[2]

◆ 

enum { ... } Relay_log_info::until_condition

◆ until_option

Until_option* Relay_log_info::until_option
private

◆ workers

Slave_worker_array Relay_log_info::workers

◆ workers_array_initialized

bool Relay_log_info::workers_array_initialized

◆ workers_copy_pfs

std::vector<Slave_worker *> Relay_log_info::workers_copy_pfs

◆ wq_size_waits_cnt

ulong Relay_log_info::wq_size_waits_cnt

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