41#ifndef MYSQL_BINLOG_EVENT_BINLOG_EVENT_H
42#define MYSQL_BINLOG_EVENT_BINLOG_EVENT_H
77#ifndef SYSTEM_CHARSET_MBMAXLEN
78#define SYSTEM_CHARSET_MBMAXLEN 3
81#define NAME_CHAR_LEN 64
84#define NAME_LEN (NAME_CHAR_LEN * SYSTEM_CHARSET_MBMAXLEN)
87#ifndef ST_SERVER_VER_SPLIT_LEN
88#define ST_SERVER_VER_SPLIT_LEN 3
95#ifndef BIN_LOG_HEADER_SIZE
96#define BIN_LOG_HEADER_SIZE 4U
106#define BINLOG_VERSION 4
117#define MAX_DBS_IN_EVENT_MTS 16
124#define OVER_MAX_DBS_IN_EVENT_MTS 254
130#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)
137#define MAX_SIZE_LOG_EVENT_STATUS \
138 (1U + 4 + 1U + 8 + 1U + 1 + \
139 255 + 1U + 4 + 1U + \
141 MAX_TIME_ZONE_NAME_LENGTH + 1U + \
147 (MAX_DBS_IN_EVENT_MTS * (1 + NAME_LEN)) \
148 + 1U + 3 + 1U + 1 + \
161#define MAX_COMMIT_TIMESTAMP_VALUE (1ULL << 55)
172#define LOG_EVENT_IGNORABLE_F 0x80
193 unsigned char split_versions[3]) {
196 unsigned long number;
197 for (
unsigned int i = 0; i <= 2; i++) {
198 number = strtoul(
p, &
r, 10);
203 if (number < 256 && (*
r ==
'.' || i != 0))
204 split_versions[i] =
static_cast<unsigned char>(number);
206 split_versions[0] = 0;
207 split_versions[1] = 0;
208 split_versions[2] = 0;
225 unsigned char version_split[3];
227 const uint32_t ret =
static_cast<uint32_t
>(version_split[0]) * 10000 +
228 static_cast<uint32_t
>(version_split[1]) * 100 +
229 static_cast<uint32_t
>(version_split[2]);
243 return ((version_split[0] * 256 + version_split[1]) * 256 + version_split[2]);
281#define LOG_EVENT_BINLOG_IN_USE_F 0x1
425#define ST_SERVER_VER_LEN 50
431#define EVENT_TYPE_OFFSET 4
432#define SERVER_ID_OFFSET 5
433#define EVENT_LEN_OFFSET 9
434#define LOG_POS_OFFSET 13
435#define FLAGS_OFFSET 17
438#define ST_BINLOG_VER_OFFSET 0
439#define ST_SERVER_VER_OFFSET 2
440#define ST_CREATED_OFFSET (ST_SERVER_VER_OFFSET + ST_SERVER_VER_LEN)
441#define ST_COMMON_HEADER_LEN_OFFSET (ST_CREATED_OFFSET + 4)
443#define LOG_EVENT_HEADER_LEN 19U
457#define LOG_EVENT_MINIMAL_HEADER_LEN 19U
479#define CHECKSUM_CRC32_SIGNATURE_LEN 4
484#define BINLOG_CHECKSUM_LEN CHECKSUM_CRC32_SIGNATURE_LEN
485#define BINLOG_CHECKSUM_ALG_DESC_LEN 1
486#define LOG_EVENT_HEADER_SIZE 20
938 virtual void print_event_info(std::ostream &info) = 0;
942 virtual void print_long_info(std::ostream &info) = 0;
1007 void print_event_info(std::ostream &info)
override;
1008 void print_long_info(std::ostream &info)
override;
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
#define ST_SERVER_VER_LEN
The length of the array server_version, which is used to store the version of MySQL server.
Definition: binlog_event.h:425
This is the abstract base class for binary log events.
Definition: binlog_event.h:859
enum_post_header_length
The lengths for the fixed data part of each event.
Definition: binlog_event.h:872
@ QUERY_HEADER_LEN
Definition: binlog_event.h:876
@ APPEND_BLOCK_HEADER_LEN
Definition: binlog_event.h:882
@ IGNORABLE_HEADER_LEN
Definition: binlog_event.h:896
@ TRANSACTION_CONTEXT_HEADER_LEN
Definition: binlog_event.h:898
@ STOP_HEADER_LEN
Definition: binlog_event.h:877
@ FORMAT_DESCRIPTION_HEADER_LEN
Definition: binlog_event.h:886
@ XID_HEADER_LEN
Definition: binlog_event.h:887
@ ROWS_HEADER_LEN_V1
Definition: binlog_event.h:889
@ BEGIN_LOAD_QUERY_HEADER_LEN
Definition: binlog_event.h:888
@ RAND_HEADER_LEN
Definition: binlog_event.h:884
@ QUERY_HEADER_MINIMAL_LEN
Definition: binlog_event.h:874
@ START_V3_HEADER_LEN
Definition: binlog_event.h:878
@ XA_PREPARE_HEADER_LEN
Definition: binlog_event.h:900
@ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN
Definition: binlog_event.h:891
@ INCIDENT_HEADER_LEN
Definition: binlog_event.h:894
@ USER_VAR_HEADER_LEN
Definition: binlog_event.h:885
@ DELETE_FILE_HEADER_LEN
Definition: binlog_event.h:883
@ ROTATE_HEADER_LEN
Definition: binlog_event.h:880
@ EXECUTE_LOAD_QUERY_HEADER_LEN
Definition: binlog_event.h:892
@ TABLE_MAP_HEADER_LEN
Definition: binlog_event.h:890
@ ROWS_HEADER_LEN_V2
Definition: binlog_event.h:897
@ VIEW_CHANGE_HEADER_LEN
Definition: binlog_event.h:899
@ TRANSACTION_PAYLOAD_HEADER_LEN
Definition: binlog_event.h:901
@ HEARTBEAT_HEADER_LEN
Definition: binlog_event.h:895
@ INTVAR_HEADER_LEN
Definition: binlog_event.h:881
const Log_event_header * header() const
Return a const pointer to the header of the log event.
Definition: binlog_event.h:959
Event_reader & reader()
Returns a reference to the event Event_reader object.
Definition: binlog_event.h:975
Binary_log_event(Log_event_type type_code)
This constructor is used to initialize the type_code of header object m_header.
Definition: binlog_event.h:910
Log_event_footer * footer()
Return a non-const pointer to the footer of the log event.
Definition: binlog_event.h:971
Log_event_header m_header
Definition: binlog_event.h:983
virtual ~Binary_log_event()=0
Log_event_footer m_footer
Definition: binlog_event.h:984
Binary_log_event & operator=(Binary_log_event &&)=default
Binary_log_event(Binary_log_event &&)=default
static const int LOG_EVENT_TYPES
Definition: binlog_event.h:866
Binary_log_event(const Binary_log_event &)=default
Binary_log_event & operator=(const Binary_log_event &)=default
Event_reader m_reader
Definition: binlog_event.h:982
Log_event_header * header()
Return a non-const pointer to the header of the log event.
Definition: binlog_event.h:963
enum Log_event_type get_event_type() const
Helper method.
Definition: binlog_event.h:954
const Log_event_footer * footer() const
Return a const pointer to the footer of the log event.
Definition: binlog_event.h:967
Event_reader class purpose is to avoid out-of-buffer reads when deserializing binary log events and i...
Definition: event_reader.h:74
An unknown event should never occur.
Definition: binlog_event.h:997
Unknown_event()
This is the minimal constructor, and set the type_code as UNKNOWN_EVENT in the header object in Binar...
Definition: binlog_event.h:1003
const char * p
Definition: ctype-mb.cc:1225
This header file contains the status of variables used by MySQL tests for debug operations.
Contains the class responsible for deserializing fields of an event previously stored in a buffer.
const unsigned char checksum_version_split[3]
Replication event checksum is introduced in the following "checksum-home" version.
Definition: binlog_event.cpp:31
void do_server_version_split(const char *version, unsigned char split_versions[3])
In case the variable is updated, make sure to update it in $MYSQL_SOURCE_DIR/my_io....
Definition: binlog_event.h:192
const int64_t UNDEFINED_COMMIT_TIMESTAMP
Used to determine whether the original_commit_timestamp is already known or if it still needs to be d...
Definition: binlog_event.h:166
const int64_t SEQ_UNINIT
Uninitialized timestamp value (for either last committed or sequence number).
Definition: binlog_event.h:158
unsigned long version_product(const unsigned char *version_split)
Calculate the version product from the numeric pieces representing the server version: For a server v...
Definition: binlog_event.h:242
const uint32_t UNKNOWN_SERVER_VERSION
Definition: binlog_event.h:169
uint32_t do_server_version_int(const char *version)
Transforms the server version from 'XX.YY.ZZ-suffix' into an integer in the format XXYYZZ.
Definition: binlog_event.h:224
const unsigned long checksum_version_product
Definition: binlog_event.cpp:32
#define MAX_COMMIT_TIMESTAMP_VALUE
We use 7 bytes, 1 bit being used as a flag.
Definition: binlog_event.h:161
const uint32_t UNDEFINED_SERVER_VERSION
Definition: binlog_event.h:168
Abstraction functions over zlib/intrinsics.
ha_checksum my_checksum(ha_checksum crc, const unsigned char *pos, size_t length)
Calculate a CRC32 checksum for a memoryblock.
Definition: my_checksum.h:117
Common #defines and includes for file and socket I/O.
Definition: buf0block_hint.cc:30
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
bool is_valid(const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, bool *is_valid) noexcept
Decides if a geometry is valid.
Definition: is_valid.cc:95
The namespace contains classes representing events that can occur in a replication stream.
Definition: binlog_event.cpp:36
constexpr size_t max_log_event_size
The maximum value for MAX_ALLOWED_PACKET.
Definition: binlog_event.h:448
uint32_t checksum_crc32(uint32_t crc, const unsigned char *pos, size_t length)
Calculate a long checksum for a memoryblock.
Definition: binlog_event.h:497
Log_event_type
Enumeration type for the different types of log events.
Definition: binlog_event.h:286
@ OBSOLETE_UPDATE_ROWS_EVENT_V1
Definition: binlog_event.h:324
@ HEARTBEAT_LOG_EVENT
Heartbeat event to be send by master at its idle time to ensure master's online status to slave.
Definition: binlog_event.h:336
@ HEARTBEAT_LOG_EVENT_V2
Definition: binlog_event.h:372
@ INCIDENT_EVENT
Something out of the ordinary happened on the master.
Definition: binlog_event.h:330
@ FORMAT_DESCRIPTION_EVENT
Definition: binlog_event.h:312
@ BEGIN_LOAD_QUERY_EVENT
Definition: binlog_event.h:314
@ EXECUTE_LOAD_QUERY_EVENT
Definition: binlog_event.h:315
@ OBSOLETE_WRITE_ROWS_EVENT_V1
Definition: binlog_event.h:323
@ XID_EVENT
Definition: binlog_event.h:313
@ ROWS_QUERY_LOG_EVENT
Definition: binlog_event.h:345
@ WRITE_ROWS_EVENT
Version 2 of the Row events.
Definition: binlog_event.h:348
@ DELETE_ROWS_EVENT
Definition: binlog_event.h:350
@ IGNORABLE_LOG_EVENT
In some situations, it is necessary to send over ignorable data to the slave: data that a slave can h...
Definition: binlog_event.h:344
@ XA_PREPARE_LOG_EVENT
Definition: binlog_event.h:362
@ QUERY_EVENT
Definition: binlog_event.h:300
@ VIEW_CHANGE_EVENT
Definition: binlog_event.h:359
@ START_EVENT_V3
Definition: binlog_event.h:299
@ UNKNOWN_EVENT
Every time you add a type, you have to.
Definition: binlog_event.h:294
@ PREVIOUS_GTIDS_LOG_EVENT
Definition: binlog_event.h:355
@ UPDATE_ROWS_EVENT
Definition: binlog_event.h:349
@ RAND_EVENT
Definition: binlog_event.h:310
@ TABLE_MAP_EVENT
Definition: binlog_event.h:317
@ DELETE_FILE_EVENT
Definition: binlog_event.h:308
@ STOP_EVENT
Definition: binlog_event.h:301
@ OBSOLETE_DELETE_ROWS_EVENT_V1
Definition: binlog_event.h:325
@ PARTIAL_UPDATE_ROWS_EVENT
Extension of UPDATE_ROWS_EVENT, allowing partial values according to binlog_row_value_options.
Definition: binlog_event.h:368
@ GTID_LOG_EVENT
Definition: binlog_event.h:352
@ ANONYMOUS_GTID_LOG_EVENT
Definition: binlog_event.h:353
@ TRANSACTION_PAYLOAD_EVENT
Definition: binlog_event.h:370
@ APPEND_BLOCK_EVENT
Definition: binlog_event.h:307
@ INTVAR_EVENT
Definition: binlog_event.h:303
@ USER_VAR_EVENT
Definition: binlog_event.h:311
@ GTID_TAGGED_LOG_EVENT
Definition: binlog_event.h:374
@ ROTATE_EVENT
Definition: binlog_event.h:302
@ SLAVE_EVENT
Definition: binlog_event.h:305
@ ENUM_END_EVENT
Add new events here - right above this comment! Existing events (except ENUM_END_EVENT) should never ...
Definition: binlog_event.h:379
@ TRANSACTION_CONTEXT_EVENT
Definition: binlog_event.h:357
const std::string & get_event_type_as_string(Log_event_type type)
Get the event type as string object.
Definition: binlog_event.cpp:80
enum_binlog_checksum_alg
Enumeration spcifying checksum algorithm used to encode a binary log event.
Definition: binlog_event.h:462
@ BINLOG_CHECKSUM_ALG_OFF
Events are without checksum though its generator is checksum-capable New Master (NM).
Definition: binlog_event.h:467
@ BINLOG_CHECKSUM_ALG_ENUM_END
the cut line: valid alg range is [1, 0x7f]
Definition: binlog_event.h:471
@ BINLOG_CHECKSUM_ALG_UNDEF
Special value to tag undetermined yet checksum or events from checksum-unaware servers.
Definition: binlog_event.h:476
@ BINLOG_CHECKSUM_ALG_CRC32
CRC32 of zlib algorithm.
Definition: binlog_event.h:469
Event_decoding_error
Errors that we distinguish during event decoding, that are translated to specific error returned by t...
Definition: event_decoding_error.h:34
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
required uint64 version
Definition: replication_group_member_actions.proto:41
required string type
Definition: replication_group_member_actions.proto:34
Struct to pass basic information about a event: type, query, is it ignorable.
Definition: binlog_event.h:407
Log_event_type event_type
Definition: binlog_event.h:408
const char * query
Definition: binlog_event.h:409
size_t query_length
Definition: binlog_event.h:410
bool ignorable_event
Definition: binlog_event.h:411
Event type helpers, enclosed in the structure.
Definition: binlog_event.h:391
static bool is_any_gtid_event(const Log_event_type &type)
Helps to identify any GTID event - returns true for GTID_LOG_EVENT, GTID_TAGGED_LOG_EVENT and ANONYMO...
Definition: binlog_event.h:399
static bool is_assigned_gtid_event(const Log_event_type &type)
Helps to identify known GTID event - returns true for GTID_LOG_EVENT and GTID_TAGGED_LOG_EVENT.
Definition: binlog_event.h:394
#define BAPI_ASSERT(x)
Definition: wrapper_functions.h:61