MySQL 8.3.0
Source Code Documentation
log_event.h File Reference

Binary log event definitions. More...

#include <atomic>
#include <cstdint>
#include <functional>
#include <list>
#include <map>
#include <set>
#include <string>
#include "lex_string.h"
#include "m_string.h"
#include "my_bitmap.h"
#include "my_checksum.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_psi_config.h"
#include "my_sharedlib.h"
#include "my_sys.h"
#include "my_thread_local.h"
#include "mysql/binlog/event/binlog_event.h"
#include "mysql/binlog/event/control_events.h"
#include "mysql/binlog/event/load_data_events.h"
#include "mysql/binlog/event/rows_event.h"
#include "mysql/binlog/event/statement_events.h"
#include "mysql/components/services/bits/psi_stage_bits.h"
#include "mysql/gtid/uuid.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql/udf_registration_types.h"
#include "mysql_com.h"
#include "partition_info.h"
#include "sql/query_options.h"
#include "sql/rpl_gtid.h"
#include "sql/rpl_utility.h"
#include "sql/sql_const.h"
#include "sql/thr_malloc.h"
#include "sql_string.h"
#include "string_with_len.h"
#include "strmake.h"
#include "typelib.h"
#include <stdio.h>
#include "my_compiler.h"
#include "sql/changestreams/misc/replicated_columns_view.h"
#include "sql/key.h"
#include "sql/rpl_filter.h"
#include "sql/table.h"
#include "sql/xa.h"
#include <limits.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include "mysql/psi/mysql_stage.h"

Go to the source code of this file.

Classes

struct  Mts_db_names
 
class  Log_event
 This is the abstract base class for binary log events. More...
 
class  Query_log_event
 A Query event is written to the binary log whenever the database is modified on the master, unless row based logging is used. More...
 
class  Format_description_log_event
 For binlog version 4. More...
 
class  Intvar_log_event
 The class derives from the class Intvar_event in Binlog API, defined in the header binlog_event.h. More...
 
class  Rand_log_event
 Logs random seed used by the next RAND(), and by PASSWORD() in 4.1.0. More...
 
class  Xid_apply_log_event
 
class  Xid_log_event
 This is the subclass of Xid_event defined in libbinlogevent, An XID event is generated for a commit of a transaction that modifies one or more tables of an XA-capable storage engine Logs xid of the transaction-to-be-committed in the 2pc protocol. More...
 
class  XA_prepare_log_event
 Similar to Xid_log_event except that. More...
 
class  User_var_log_event
 Every time a query uses the value of a user variable, a User_var_log_event is written before the Query_log_event, to set the user variable. More...
 
class  Stop_log_event
 
class  Rotate_log_event
 This will be deprecated when we move to using sequence ids. More...
 
class  Append_block_log_event
 This event is created to contain the file data. More...
 
class  Delete_file_log_event
 Delete_file_log_event is created when the LOAD_DATA query fails on the master for some reason, and the slave should be notified to abort the load. More...
 
class  Begin_load_query_log_event
 Event for the first block of file to be loaded, its only difference from Append_block event is that this event creates or truncates existing file before writing data. More...
 
class  Execute_load_query_log_event
 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...
 
class  Load_query_generator
 
class  Table_map_log_event
 Table_map_log_event which maps a table definition to a number. More...
 
class  Rows_applier_psi_stage
 
class  Rows_log_event
 Common base class for all row-containing log events. More...
 
class  Rows_log_event::Key_compare
 
class  Write_rows_log_event
 Log row insertions and updates. More...
 
class  Update_rows_log_event
 Log row updates with a before image. More...
 
class  Delete_rows_log_event
 Log row deletions. More...
 
class  Incident_log_event
 Class representing an incident, an occurrence out of the ordinary, that happened on the master. More...
 
class  Ignorable_log_event
 Base class for ignorable log events is Ignorable_event. More...
 
class  Rows_query_log_event
 It is used to record the original query for the rows events in RBR. More...
 
class  Heartbeat_log_event
 
class  Heartbeat_log_event_v2
 
class  Transaction_payload_log_event
 
class  Transaction_payload_log_event::Applier_context
 
class  Gtid_log_event
 This is a subclass if Gtid_event and Log_event. More...
 
class  Previous_gtids_log_event
 This is the subclass of Previous_gtids_event and Log_event It is used to record the gtid_executed in the last binary log file, for ex after flush logs, or at the starting of the binary log file. More...
 
class  Transaction_context_log_event
 This is the subclass of Transaction_context_event and Log_event This class encodes the transaction_context_log_event. More...
 
class  View_change_log_event
 This is the subclass of View_change_log_event and Log_event This class created the view_change_log_event which is used as a marker in case a new node joins or leaves the group. More...
 

Namespaces

namespace  mysql
 
namespace  mysql::binlog
 
namespace  mysql::binlog::event
 The namespace contains classes representing events that can occur in a replication stream.
 

Macros

#define PREFIX_SQL_LOAD   "SQL_LOAD-"
 
#define TEMP_FILE_MAX_LEN   UUID_LENGTH + 38
 Maximum length of the name of a temporary file PREFIX LENGTH - 9 UUID - UUID_LENGTH SEPARATORS - 2 SERVER ID - 10 (range of server ID 1 to (2^32)-1 = 4,294,967,295) FILE ID - 10 (uint) EXTENSION - 7 (Assuming that the extension is always less than 7 characters) More...
 
#define ASSERT_OR_RETURN_ERROR(COND, ERRNO)   assert(COND)
 Either assert or return an error. More...
 
#define LOG_EVENT_OFFSET   4
 
#define NUM_LOAD_DELIM_STRS   5
 
#define MAX_LOG_EVENT_HEADER
 
#define SL_MASTER_PORT_OFFSET   8
 
#define SL_MASTER_POS_OFFSET   0
 
#define SL_MASTER_HOST_OFFSET   10
 
#define I_TYPE_OFFSET   0
 
#define I_VAL_OFFSET   1
 
#define BINLOG_MAGIC   "\xfe\x62\x69\x6e"
 
#define BINLOG_MAGIC_SIZE   4
 
#define LOG_EVENT_THREAD_SPECIFIC_F   0x4
 If the query depends on the thread (for example: TEMPORARY TABLE). More...
 
#define LOG_EVENT_SUPPRESS_USE_F   0x8
 Suppress the generation of 'USE' statements before the actual statement. More...
 
#define LOG_EVENT_ARTIFICIAL_F   0x20
 Artificial events are created arbitrarily and not written to binary log. More...
 
#define LOG_EVENT_RELAY_LOG_F   0x40
 Events with this flag set are created by slave IO thread and written to relay log. More...
 
#define LOG_EVENT_IGNORABLE_F   0x80
 For an event, 'e', carrying a type code, that a slave, 's', does not recognize, 's' will check 'e' for LOG_EVENT_IGNORABLE_F, and if the flag is set, then 'e' is ignored. More...
 
#define LOG_EVENT_NO_FILTER_F   0x100
 Events with this flag are not filtered (e.g. More...
 
#define LOG_EVENT_MTS_ISOLATE_F   0x200
 MTS: group of events can be marked to force its execution in isolation from any other Workers. More...
 
#define OPTIONS_WRITTEN_TO_BIN_LOG
 OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must be written to the binlog. More...
 
#define EXPECTED_OPTIONS    ((1ULL << 14) | (1ULL << 26) | (1ULL << 27) | (1ULL << 19))
 

Typedefs

using ColumnViewPtr = std::unique_ptr< cs::util::ReplicatedColumnsView >
 
using sql_mode_t = uint64_t
 

Functions

int ignored_error_code (int err_code)
 Ignore error code specified on command line. More...
 
int get_rpl_part_id (partition_info *part_info)
 This method is used to extract the partition_id from a partitioned table. More...
 
char * str_to_hex (char *to, const char *from, size_t len)
 Transforms a string into "" or its expression in 0x... form. More...
 
static bool copy_event_cache_to_file_and_reinit (IO_CACHE *cache, FILE *file, bool flush_stream)
 
bool slave_execute_deferred_events (THD *thd)
 The function is called by slave applier in case there are active table filtering rules to force gathering events associated with Query-log-event into an array to execute them once the fate of the Query is determined for execution. More...
 
int append_query_string (const THD *thd, const CHARSET_INFO *csinfo, String const *from, String *to)
 Append a version of the 'from' string suitable for use in a query to the 'to' string. More...
 
bool is_any_gtid_event (const Log_event *evt)
 
bool is_session_control_event (Log_event *evt)
 Check if the given event is a session control event, one of User_var_event, Intvar_event or Rand_event. More...
 
bool is_atomic_ddl_event (Log_event const *evt)
 The function checks the argument event properties to deduce whether it represents an atomic DDL. More...
 
bool is_atomic_ddl (THD *thd, bool using_trans)
 The function lists all DDL instances that are supported for crash-recovery (WL9175). More...
 
template<class EVENT >
bool binary_event_serialize (EVENT *ev, Basic_ostream *ostream)
 Serialize an binary event to the given output stream. More...
 
size_t my_strmov_quoted_identifier (THD *thd, char *buffer, const char *identifier, size_t length)
 
size_t my_strmov_quoted_identifier_helper (int q, char *buffer, const char *identifier, size_t length)
 
template<typename T >
bool net_field_length_checked (const uchar **packet, size_t *max_length, T *out)
 Read an integer in net_field_length format, guarding against read out of bounds and advancing the position. More...
 
std::pair< bool, mysql::binlog::event::Log_event_basic_infoextract_log_event_basic_info (Log_event *log_event)
 Extract basic info about an event: type, query, is it ignorable. More...
 
std::pair< bool, mysql::binlog::event::Log_event_basic_infoextract_log_event_basic_info (const char *buf, size_t length, const mysql::binlog::event::Format_description_event *fd_event)
 Extract basic info about an event: type, query, is it ignorable. More...
 

Variables

PSI_memory_key key_memory_Incident_log_event_message
 
PSI_memory_key key_memory_Rows_query_log_event_rows_query
 
MYSQL_PLUGIN_IMPORT ulong server_id
 
MYSQL_PLUGIN_IMPORT char server_version [SERVER_VERSION_LENGTH]
 
const int64 SEQ_MAX_TIMESTAMP = LLONG_MAX
 Maximum value of binlog logical timestamp. More...
 
TYPELIB binlog_checksum_typelib
 

Detailed Description

Binary log event definitions.

This includes generic code common to all types of log events, as well as specific code for each type of log event.