MySQL 9.1.0
Source Code Documentation
rpl_rli.h File Reference
#include <sys/types.h>
#include <time.h>
#include <atomic>
#include <memory>
#include <string>
#include <string_view>
#include <tuple>
#include <vector>
#include "lex_string.h"
#include "map_helpers.h"
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_psi_config.h"
#include "my_sys.h"
#include "mysql/binlog/event/binlog_event.h"
#include "mysql/components/services/bits/mysql_cond_bits.h"
#include "mysql/components/services/bits/mysql_mutex_bits.h"
#include "mysql/components/services/bits/psi_mutex_bits.h"
#include "mysql/my_loglevel.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/thread_type.h"
#include "prealloced_array.h"
#include "sql/binlog.h"
#include "sql/changestreams/apply/metrics/applier_metrics.h"
#include "sql/changestreams/apply/metrics/applier_metrics_stub.h"
#include "sql/log_event.h"
#include "sql/psi_memory_key.h"
#include "sql/query_options.h"
#include "sql/rpl_gtid.h"
#include "sql/rpl_info.h"
#include "sql/rpl_mta_submode.h"
#include "sql/rpl_replica_until_options.h"
#include "sql/rpl_tblmap.h"
#include "sql/rpl_trx_boundary_parser.h"
#include "sql/rpl_utility.h"
#include "sql/sql_class.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "strmake.h"

Go to the source code of this file.

Classes

struct  slave_job_item
 
class  Assign_gtids_to_anonymous_transactions_info
 This class is used to store the type and value for Assign_gtids_to_anonymous_transactions parameter of Change replication source command on slave. More...
 
class  Relay_log_info
 
class  RLI_current_event_raii
 RAII class to control the slave applier execution context binding with a being handled event. More...
 
class  MDL_lock_guard
 Utility class to allow RAII pattern with MDL_request and MDL_context classes. More...
 
class  Applier_security_context_guard
 Utility class to allow RAII pattern with Security_context class. More...
 

Typedefs

typedef Prealloced_array< Slave_worker *, 4 > Slave_worker_array
 
typedef struct slave_job_item Slave_job_item
 

Functions

bool operator! (Relay_log_info::enum_priv_checks_status status)
 Negation operator for enum_priv_checks_status, to facilitate validation against SUCCESS. More...
 
bool operator! (Relay_log_info::enum_require_row_status status)
 Negation operator for enum_require_row_status, to facilitate validation against SUCCESS. More...
 
bool mysql_show_relaylog_events (THD *thd)
 Execute a SHOW RELAYLOG EVENTS statement. More...
 
bool is_mts_worker (const THD *thd)
 
bool is_mts_db_partitioned (Relay_log_info *rli)
 Auxiliary function to check if we have a db partitioned MTS. More...
 
bool is_committed_ddl (Log_event *ev)
 Checks whether the supplied event encodes a (2pc-aware) DDL that has been already committed. More...
 
bool is_atomic_ddl_commit_on_slave (THD *thd)
 Checks whether the transaction identified by the argument is executed by a slave applier thread is an atomic DDL not yet committed (see Query_log_event::has_ddl_committed). More...
 

Variables

uint sql_replica_skip_counter
 a copy of active_mi->rli->slave_skip_counter, for showing in SHOW GLOBAL VARIABLES, INFORMATION_SCHEMA.GLOBAL_VARIABLES and @sql_replica_skip_counter without taking all the mutexes needed to access active_mi->rli->slave_skip_counter properly. More...
 

Typedef Documentation

◆ Slave_job_item

◆ Slave_worker_array

Function Documentation

◆ is_atomic_ddl_commit_on_slave()

bool is_atomic_ddl_commit_on_slave ( THD thd)
inline

Checks whether the transaction identified by the argument is executed by a slave applier thread is an atomic DDL not yet committed (see Query_log_event::has_ddl_committed).

THD::is_operating_substatement_implicitly filters out intermediate commits done by non-atomic DDLs. The error-tagged atomic statements are regarded as non-atomic therefore this predicate returns negative in such case.

Note that call to is_atomic_ddl() returns "approximate" outcome in this case as it misses information about type of tables used by the DDL.

This can be a problem for binlogging slave, as updates to slave info which happen in the same transaction as write of binary log event without XID might be lost on recovery. To avoid this problem RLI::ddl_not_atomic flag is employed which is set to true when non-atomic DDL without XID is written to the binary log.

"Approximate" outcome is always fine for non-binlogging slave as in this case commit happens using one-phase routine for which recovery is always correct.

Parameters
thda pointer to THD describing the transaction context
Returns
true when a slave applier thread is set to commit being processed DDL query-log-event, otherwise returns false.

◆ is_committed_ddl()

bool is_committed_ddl ( Log_event ev)
inline

Checks whether the supplied event encodes a (2pc-aware) DDL that has been already committed.

Parameters
evA reference to Query-log-event
Returns
true when the event is already committed transactional DDL

◆ is_mts_db_partitioned()

bool is_mts_db_partitioned ( Relay_log_info rli)

Auxiliary function to check if we have a db partitioned MTS.

◆ is_mts_worker()

bool is_mts_worker ( const THD thd)
inline
Parameters
thda reference to THD
Returns
true if thd belongs to a Worker thread and false otherwise.

◆ mysql_show_relaylog_events()

bool mysql_show_relaylog_events ( THD thd)

Execute a SHOW RELAYLOG EVENTS statement.

When multiple replication channels exist on this slave and no channel name is specified through FOR CHANNEL clause this function errors out and exits.

Parameters
thdPointer to THD object for the client thread executing the statement.
Return values
falsesuccess
truefailure

◆ operator!() [1/2]

bool operator! ( Relay_log_info::enum_priv_checks_status  status)

Negation operator for enum_priv_checks_status, to facilitate validation against SUCCESS.

To test for error status, use the !! idiom.

Parameters
statusthe status code to check against SUCCESS
Returns
true if the status is SUCCESS and false otherwise.

◆ operator!() [2/2]

bool operator! ( Relay_log_info::enum_require_row_status  status)

Negation operator for enum_require_row_status, to facilitate validation against SUCCESS.

To test for error status, use the !! idiom.

Parameters
statusthe status code to check against SUCCESS
Returns
true if the status is SUCCESS and false otherwise.