MySQL 9.1.0
Source Code Documentation
Execute_load_query_log_event Class Reference

Event responsible for LOAD DATA execution, it similar to Query_log_event but before executing the query it substitutes original filename in LOAD DATA query with name of temporary file. More...

#include <log_event.h>

Inheritance diagram for Execute_load_query_log_event:
[legend]

Public Member Functions

 Execute_load_query_log_event (THD *thd, const char *query_arg, ulong query_length, uint fn_pos_start_arg, uint fn_pos_end_arg, mysql::binlog::event::enum_load_dup_handling dup_handling_arg, bool using_trans, bool immediate, bool suppress_use, int errcode)
 
int pack_info (Protocol *protocol) override
 This (which is used only for SHOW BINLOG EVENTS) could be updated to print SET @session_var=. More...
 
 Execute_load_query_log_event (const char *buf, const mysql::binlog::event::Format_description_event *description_event)
 
 ~Execute_load_query_log_event () override=default
 
ulong get_post_header_size_for_derived () override
 
bool write_post_header_for_derived (Basic_ostream *ostream) override
 
bool is_sbr_logging_format () const override
 When a query log event contains a non-transaction control statement, we assume that it is changing database content (DML) and was logged using binlog_format=statement. More...
 
void claim_memory_ownership (bool claim) override
 Allow thread to CLAIM or DISCLAIM the ownership of this object depends on the parameter value passed. More...
 
- Public Member Functions inherited from Query_log_event
 Query_log_event (Query_log_event &&) noexcept=delete
 
Query_log_eventoperator= (Query_log_event &&) noexcept=delete
 
 Query_log_event (const Query_log_event &)=delete
 
Query_log_eventoperator= (const Query_log_event &)=delete
 
void set_skip_temp_tables_handling_by_worker ()
 
bool is_skip_temp_tables_handling_by_worker ()
 
 Query_log_event (THD *thd_arg, const char *query_arg, size_t query_length, bool using_trans, bool immediate, bool suppress_use, int error, bool ignore_command=false)
 Creates a Query Log Event. More...
 
const char * get_db () override
 
uint8 get_mts_dbs (Mts_db_names *arg, Rpl_filter *rpl_filter) override
 
void attach_temp_tables_worker (THD *, const Relay_log_info *)
 Associating slave Worker thread to a subset of temporary tables. More...
 
void detach_temp_tables_worker (THD *, const Relay_log_info *)
 Dissociating slave Worker thread from its thd->temporary_tables to possibly update the involved entries of db-to-worker hash with new values of temporary_tables. More...
 
uchar mts_number_dbs () override
 
 Query_log_event ()
 The simplest constructor that could possibly work. More...
 
 Query_log_event (const char *buf, const mysql::binlog::event::Format_description_event *description_event, mysql::binlog::event::Log_event_type event_type)
 This is used by the SQL slave thread to prepare the event before execution. More...
 
 ~Query_log_event () override
 
bool write (Basic_ostream *ostream) override
 Query_log_event::write(). More...
 
enum_skip_reason do_shall_skip (Relay_log_info *rli) override
 Decide if this event shall be skipped or not and the reason for skipping it. More...
 
int do_update_pos (Relay_log_info *rli) override
 Advance relay log coordinates. More...
 
int do_apply_event (Relay_log_info const *rli, const char *query_arg, size_t q_len_arg)
 
bool is_trans_keyword () const
 
bool starts_group () const override
 Notice, DDL queries are logged without BEGIN/COMMIT parentheses and identification of such single-query group occurs within logics of get_slave_worker(). More...
 
bool ends_group () const override
 
bool is_query_prefix_match (const char *pattern, uint p_len)
 
- Public Member Functions inherited from mysql::binlog::event::Query_event
 Query_event (const char *query_arg, const char *catalog_arg, const char *db_arg, uint32_t query_length, unsigned long thread_id_arg, unsigned long long sql_mode_arg, unsigned long auto_increment_increment_arg, unsigned long auto_increment_offset_arg, unsigned int number, unsigned long long table_map_for_update_arg, int errcode)
 The constructor will be used while creating a Query_event, to be written to the binary log. More...
 
 Query_event (const char *buf, const Format_description_event *fde, Log_event_type event_type)
 The constructor receives a buffer and instantiates a Query_event filled in with the data from the buffer. More...
 
 Query_event (Log_event_type type_arg=QUERY_EVENT)
 The simplest constructor that could possibly work. More...
 
 ~Query_event () override=default
 
- Public Member Functions inherited from mysql::binlog::event::Binary_log_event
virtual ~Binary_log_event ()=0
 
 Binary_log_event (const Binary_log_event &)=default
 
 Binary_log_event (Binary_log_event &&)=default
 
Binary_log_eventoperator= (const Binary_log_event &)=default
 
Binary_log_eventoperator= (Binary_log_event &&)=default
 
enum Log_event_type get_event_type () const
 Helper method. More...
 
const Log_event_headerheader () const
 Return a const pointer to the header of the log event. More...
 
Log_event_headerheader ()
 Return a non-const pointer to the header of the log event. More...
 
const Log_event_footerfooter () const
 Return a const pointer to the footer of the log event. More...
 
Log_event_footerfooter ()
 Return a non-const pointer to the footer of the log event. More...
 
Event_readerreader ()
 Returns a reference to the event Event_reader object. More...
 
- Public Member Functions inherited from Log_event
 Log_event (mysql::binlog::event::Log_event_header *header, mysql::binlog::event::Log_event_footer *footer, enum_event_cache_type cache_type_arg, enum_event_logging_type logging_type_arg)
 This minimal constructor is for when you are not even sure that there is a valid THD. More...
 
 Log_event (THD *thd_arg, uint16 flags_arg, enum_event_cache_type cache_type_arg, enum_event_logging_type logging_type_arg, mysql::binlog::event::Log_event_header *header, mysql::binlog::event::Log_event_footer *footer)
 
int net_send (Protocol *protocol, const char *log_name, my_off_t pos)
 Only called by SHOW BINLOG EVENTS. More...
 
void * operator new (size_t size)
 
bool wrapper_my_b_safe_write (Basic_ostream *ostream, const uchar *buf, size_t data_length)
 Write the given buffer to the given output stream, updating the checksum if checksums are enabled. More...
 
time_t get_time ()
 Prints a "session_var=value" string. More...
 
virtual bool write_data_header (Basic_ostream *)
 
virtual bool write_data_body (Basic_ostream *)
 
virtual mysql::binlog::event::Log_event_type get_type_code () const
 
virtual bool is_rbr_logging_format () const
 Return true if the event has to be logged using RBR for DMLs. More...
 
bool is_valid ()
 
void set_artificial_event ()
 
void set_relay_log_event ()
 
bool is_artificial_event () const
 
bool is_relay_log_event () const
 
bool is_ignorable_event () const
 
bool is_no_filter_event () const
 
bool is_using_trans_cache () const
 
bool is_using_stmt_cache () const
 
bool is_using_immediate_logging () const
 
 Log_event (mysql::binlog::event::Log_event_header *header, mysql::binlog::event::Log_event_footer *footer)
 
virtual ~Log_event ()
 
void register_temp_buf (char *buf, bool free_in_destructor=true)
 
void free_temp_buf ()
 
virtual size_t get_data_size ()
 
const char * get_type_str () const
 Returns the human readable name of this event's type. More...
 
bool is_mts_sequential_exec () const
 Is called from get_mts_execution_mode() to. More...
 
bool contains_partition_info (bool)
 
bool is_mts_group_isolated ()
 
int apply_event (Relay_log_info *rli)
 Apply the event to the database. More...
 
int apply_gtid_event (Relay_log_info *rli)
 Apply the GTID event in curr_group_data to the database. More...
 
int update_pos (Relay_log_info *rli)
 Update the relay log position. More...
 
enum_skip_reason shall_skip (Relay_log_info *rli)
 Decide if the event shall be skipped, and the reason for skipping it. More...
 
virtual int do_apply_event_worker (Slave_worker *w)
 
- Public Member Functions inherited from mysql::binlog::event::Execute_load_query_event
 Execute_load_query_event (uint32_t file_id_arg, uint32_t fn_pos_start, uint32_t fn_pos_end, enum_load_dup_handling dup)
 The constructor is called by MySQL slave, while applying the events. More...
 
 Execute_load_query_event (const char *buf, const Format_description_event *fde)
 The constructor receives a buffer and instantiates a Execute_load_query_event filled in with the data from the buffer. More...
 
 ~Execute_load_query_event () override=default
 

Private Member Functions

int do_apply_event (Relay_log_info const *rli) override
 Primitive to apply an event to the database. More...
 

Additional Inherited Members

- Public Types inherited from mysql::binlog::event::Query_event
enum  Query_event_post_header_offset {
  Q_THREAD_ID_OFFSET = 0 , Q_EXEC_TIME_OFFSET = 4 , Q_DB_LEN_OFFSET = 8 , Q_ERR_CODE_OFFSET = 9 ,
  Q_STATUS_VARS_LEN_OFFSET = 11 , Q_DATA_OFFSET = QUERY_HEADER_LEN
}
 query event post-header More...
 
enum  Query_event_status_vars {
  Q_FLAGS2_CODE = 0 , Q_SQL_MODE_CODE , Q_CATALOG_CODE , Q_AUTO_INCREMENT ,
  Q_CHARSET_CODE , Q_TIME_ZONE_CODE , Q_CATALOG_NZ_CODE , Q_LC_TIME_NAMES_CODE ,
  Q_CHARSET_DATABASE_CODE , Q_TABLE_MAP_FOR_UPDATE_CODE , Q_MASTER_DATA_WRITTEN_CODE , Q_INVOKER ,
  Q_UPDATED_DB_NAMES , Q_MICROSECONDS , Q_COMMIT_TS , Q_COMMIT_TS2 ,
  Q_EXPLICIT_DEFAULTS_FOR_TIMESTAMP , Q_DDL_LOGGED_WITH_XID , Q_DEFAULT_COLLATION_FOR_UTF8MB4 , Q_SQL_REQUIRE_PRIMARY_KEY ,
  Q_DEFAULT_TABLE_ENCRYPTION
}
 
enum  enum_ternary { TERNARY_UNSET , TERNARY_OFF , TERNARY_ON }
 
- Public Types inherited from mysql::binlog::event::Binary_log_event
enum  enum_post_header_length {
  QUERY_HEADER_MINIMAL_LEN = (4 + 4 + 1 + 2) , QUERY_HEADER_LEN = (QUERY_HEADER_MINIMAL_LEN + 2) , STOP_HEADER_LEN = 0 , START_V3_HEADER_LEN = (2 + ST_SERVER_VER_LEN + 4) ,
  ROTATE_HEADER_LEN = 8 , INTVAR_HEADER_LEN = 0 , APPEND_BLOCK_HEADER_LEN = 4 , DELETE_FILE_HEADER_LEN = 4 ,
  RAND_HEADER_LEN = 0 , USER_VAR_HEADER_LEN = 0 , FORMAT_DESCRIPTION_HEADER_LEN = (START_V3_HEADER_LEN + 1 + LOG_EVENT_TYPES) , XID_HEADER_LEN = 0 ,
  BEGIN_LOAD_QUERY_HEADER_LEN = APPEND_BLOCK_HEADER_LEN , ROWS_HEADER_LEN_V1 = 8 , TABLE_MAP_HEADER_LEN = 8 , EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN = (4 + 4 + 4 + 1) ,
  EXECUTE_LOAD_QUERY_HEADER_LEN , INCIDENT_HEADER_LEN = 2 , HEARTBEAT_HEADER_LEN = 0 , IGNORABLE_HEADER_LEN = 0 ,
  ROWS_HEADER_LEN_V2 = 10 , TRANSACTION_CONTEXT_HEADER_LEN = 18 , VIEW_CHANGE_HEADER_LEN = 52 , XA_PREPARE_HEADER_LEN = 0 ,
  TRANSACTION_PAYLOAD_HEADER_LEN = 0
}
 The lengths for the fixed data part of each event. More...
 
- Public Types inherited from Log_event
enum  enum_skip_reason { EVENT_SKIP_NOT , EVENT_SKIP_IGNORE , EVENT_SKIP_COUNT }
 Enumeration of what kinds of skipping (and non-skipping) that can occur when the slave executes an event. More...
 
enum  enum_mts_event_exec_mode { EVENT_EXEC_PARALLEL , EVENT_EXEC_ASYNC , EVENT_EXEC_SYNC , EVENT_EXEC_CAN_NOT }
 
- Public Types inherited from mysql::binlog::event::Execute_load_query_event
enum  Execute_load_query_event_offset { ELQ_FILE_ID_OFFSET = QUERY_HEADER_LEN , ELQ_FN_POS_START_OFFSET = ELQ_FILE_ID_OFFSET + 4 , ELQ_FN_POS_END_OFFSET = ELQ_FILE_ID_OFFSET + 8 , ELQ_DUP_HANDLING_OFFSET = ELQ_FILE_ID_OFFSET + 12 }
 
- Static Public Member Functions inherited from Query_log_event
static size_t get_query (const char *buf, size_t length, const mysql::binlog::event::Format_description_event *fd_event, const char **query_arg)
 Return the query string pointer (and its size) from a Query log event using only the event buffer (we don't instantiate a Query_log_event object for this). More...
 
- Static Public Member Functions inherited from Log_event
static void init_show_field_list (mem_root_deque< Item * > *field_list)
 init_show_field_list() prepares the column names and types for the output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG EVENTS. More...
 
static void operator delete (void *ptr, size_t)
 
static void * operator new (size_t, void *ptr)
 
static void operator delete (void *, void *)
 
static const char * get_type_str (mysql::binlog::event::Log_event_type type)
 Returns the human readable name of the given event type. More...
 
static const char * get_type_str (uint type)
 Get the name of an event type, or "Unknown" if out of range. More...
 
static bool is_mts_sequential_exec (mysql::binlog::event::Log_event_type type_code)
 
static enum enum_mts_event_exec_mode get_mts_execution_mode (bool mts_in_group, mysql::binlog::event::Log_event_type type_code, uint32 server_id, uint32 log_pos)
 
- Public Attributes inherited from Query_log_event
my_thread_id slave_proxy_id
 
bool rollback_injected_by_coord = false
 True if this is a ROLLBACK event injected by the mts coordinator to finish a group corresponding to a partial transaction in the relay log. More...
 
bool has_ddl_committed
 The flag indicates whether the DDL query has been (already) committed or not. More...
 
bool m_skip_temp_tables_handling_by_worker {false}
 Instructs the applier to skip temporary tables handling. More...
 
bool need_sql_require_primary_key {false}
 Whether or not the statement represented by this event requires Q_SQL_REQUIRE_PRIMARY_KEY to be logged along aside. More...
 
bool needs_default_table_encryption {false}
 Whether or not the statement represented by this event requires Q_DEFAULT_TABLE_ENCRYPTION to be logged along aside. More...
 
- Public Attributes inherited from mysql::binlog::event::Query_event
const char * query
 
const char * db
 
const char * catalog
 
const char * time_zone_str
 
uint32_t thread_id
 
uint32_t query_exec_time
 
size_t db_len
 
uint16_t error_code
 
uint16_t status_vars_len
 
size_t q_len
 
bool flags2_inited
 
bool sql_mode_inited
 
bool charset_inited
 
uint32_t flags2
 
uint64_t sql_mode
 
uint16_t auto_increment_increment
 
uint16_t auto_increment_offset
 
char charset [6]
 
size_t time_zone_len
 
size_t catalog_len
 
uint16_t lc_time_names_number
 
uint16_t charset_database_number
 
uint64_t table_map_for_update
 
enum mysql::binlog::event::Query_event::enum_ternary explicit_defaults_ts
 
unsigned char mts_accessed_dbs
 
char mts_accessed_db_names [MAX_DBS_IN_EVENT_MTS][NAME_LEN]
 
uint64_t ddl_xid
 
uint16_t default_collation_for_utf8mb4_number
 
uint8_t sql_require_primary_key
 
uint8_t default_table_encryption
 
- Public Attributes inherited from Log_event
char * temp_buf
 
bool m_free_temp_buf_in_destructor
 
ulong exec_time
 
uint32 server_id
 
ulong rbr_exec_mode
 A storage to cache the global system variable's value. More...
 
enum_event_cache_type event_cache_type
 Defines the type of the cache, if any, where the event will be stored before being flushed to disk. More...
 
enum_event_logging_type event_logging_type
 Defines when information, i.e. More...
 
ha_checksum crc
 Placeholder for event checksum while writing to binlog. More...
 
ulong mts_group_idx
 Index in rli->gaq array to indicate a group that this event is purging. More...
 
mysql::binlog::event::Log_event_headercommon_header
 The Log_event_header class contains the variable present in the common header. More...
 
mysql::binlog::event::Log_event_footercommon_footer
 The Log_event_footer class contains the variable present in the common footer. More...
 
Relay_log_infoworker
 MTS: associating the event with either an assigned Worker or Coordinator. More...
 
ulonglong future_event_relay_log_pos
 A copy of the main rli value stored into event to pass to MTS worker rli. More...
 
THDthd
 
db_worker_hash_entrymts_assigned_partitions [MAX_DBS_IN_EVENT_MTS]
 Partition info associate with event to deliver to MTS event applier. More...
 
- Public Attributes inherited from mysql::binlog::event::Execute_load_query_event
int32_t file_id
 
uint32_t fn_pos_start
 file_id of temporary file More...
 
uint32_t fn_pos_end
 pointer to the part of the query that should be substituted More...
 
enum_load_dup_handling dup_handling
 pointer to the end of this part of query More...
 
- Static Public Attributes inherited from mysql::binlog::event::Binary_log_event
static const int LOG_EVENT_TYPES = (ENUM_END_EVENT - 1)
 
- Protected Types inherited from Log_event
enum  enum_event_cache_type {
  EVENT_INVALID_CACHE = 0 , EVENT_STMT_CACHE , EVENT_TRANSACTIONAL_CACHE , EVENT_NO_CACHE ,
  EVENT_CACHE_COUNT
}
 
enum  enum_event_logging_type { EVENT_INVALID_LOGGING = 0 , EVENT_NORMAL_LOGGING , EVENT_IMMEDIATE_LOGGING , EVENT_CACHE_LOGGING_COUNT }
 
- Protected Member Functions inherited from mysql::binlog::event::Query_event
int fill_data_buf (unsigned char *dest, unsigned long len)
 Layout for the data buffer is as follows. More...
 
- Protected Member Functions inherited from mysql::binlog::event::Binary_log_event
 Binary_log_event (Log_event_type type_code)
 This constructor is used to initialize the type_code of header object m_header. More...
 
 Binary_log_event (const char **buf, const Format_description_event *fde)
 This constructor will create a new object of Log_event_header and initialize the variable m_header, which in turn will be used to initialize Log_event's member common_header. More...
 
- Protected Member Functions inherited from Log_event
uint32 write_header_to_memory (uchar *buf)
 Writes the common header of this event to the given memory buffer. More...
 
bool write_header (Basic_ostream *ostream, size_t data_length)
 Writes the common-header of this event to the given output stream and updates the checksum. More...
 
bool write_footer (Basic_ostream *ostream)
 
bool need_checksum ()
 A decider of whether to trigger checksum computation or not. More...
 
enum_skip_reason continue_group (Relay_log_info *rli)
 Helper function to ignore an event w.r.t. More...
 
- Protected Attributes inherited from Query_log_event
mysql::binlog::event::Log_event_header::Bytedata_buf
 
- Protected Attributes inherited from mysql::binlog::event::Query_event
const char * user
 
size_t user_len
 
const char * host
 
size_t host_len
 
unsigned long data_len
 

Detailed Description

Event responsible for LOAD DATA execution, it similar to Query_log_event but before executing the query it substitutes original filename in LOAD DATA query with name of temporary file.

Binary Format

Constructor & Destructor Documentation

◆ Execute_load_query_log_event() [1/2]

Execute_load_query_log_event::Execute_load_query_log_event ( THD thd,
const char *  query_arg,
ulong  query_length,
uint  fn_pos_start_arg,
uint  fn_pos_end_arg,
mysql::binlog::event::enum_load_dup_handling  dup_handling_arg,
bool  using_trans,
bool  immediate,
bool  suppress_use,
int  errcode 
)

◆ Execute_load_query_log_event() [2/2]

Execute_load_query_log_event::Execute_load_query_log_event ( const char *  buf,
const mysql::binlog::event::Format_description_event description_event 
)

◆ ~Execute_load_query_log_event()

Execute_load_query_log_event::~Execute_load_query_log_event ( )
overridedefault

Member Function Documentation

◆ claim_memory_ownership()

void Execute_load_query_log_event::claim_memory_ownership ( bool  claim)
overridevirtual

Allow thread to CLAIM or DISCLAIM the ownership of this object depends on the parameter value passed.

Parameters
claimTrue - claim ownership of the memory False - disclaim ownership of the memory

Reimplemented from Query_log_event.

◆ do_apply_event()

int Execute_load_query_log_event::do_apply_event ( Relay_log_info const *  rli)
overrideprivatevirtual

Primitive to apply an event to the database.

This is where the change to the database is made.

Note
The primitive is protected instead of private, since there is a hierarchy of actions to be performed in some cases.
See also
Format_description_log_event::do_apply_event()
Parameters
rliPointer to relay log info structure
Return values
0Event applied successfully
errnoError code if event application failed

Reimplemented from Query_log_event.

◆ get_post_header_size_for_derived()

ulong Execute_load_query_log_event::get_post_header_size_for_derived ( )
overridevirtual

Reimplemented from Query_log_event.

◆ is_sbr_logging_format()

bool Execute_load_query_log_event::is_sbr_logging_format ( ) const
inlineoverridevirtual

When a query log event contains a non-transaction control statement, we assume that it is changing database content (DML) and was logged using binlog_format=statement.

Returns
True the event represents a statement that was logged using SBR that can change database content. False for transaction control statements.

Reimplemented from Query_log_event.

◆ pack_info()

int Execute_load_query_log_event::pack_info ( Protocol protocol)
overridevirtual

This (which is used only for SHOW BINLOG EVENTS) could be updated to print SET @session_var=.

But this is not urgent, as SHOW BINLOG EVENTS is only an information, it does not produce suitable queries to replay (for example it does not print LOAD DATA INFILE).

Reimplemented from Query_log_event.

◆ write_post_header_for_derived()

bool Execute_load_query_log_event::write_post_header_for_derived ( Basic_ostream ostream)
overridevirtual

Reimplemented from Query_log_event.


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