35#ifndef BINLOG_EVENT_INCLUDED
36#define BINLOG_EVENT_INCLUDED
65#ifndef SYSTEM_CHARSET_MBMAXLEN
66#define SYSTEM_CHARSET_MBMAXLEN 3
69#define NAME_CHAR_LEN 64
72#define NAME_LEN (NAME_CHAR_LEN * SYSTEM_CHARSET_MBMAXLEN)
75#ifndef ST_SERVER_VER_SPLIT_LEN
76#define ST_SERVER_VER_SPLIT_LEN 3
83#ifndef BIN_LOG_HEADER_SIZE
84#define BIN_LOG_HEADER_SIZE 4U
94#define BINLOG_VERSION 4
105#define MAX_DBS_IN_EVENT_MTS 16
112#define OVER_MAX_DBS_IN_EVENT_MTS 254
119#define MAX_SIZE_LOG_EVENT_STATUS \
120 (1U + 4 + 1U + 8 + 1U + 1 + \
121 255 + 1U + 4 + 1U + \
122 6 + 1U + 1 + 255 + 1U + \
127 1U + (MAX_DBS_IN_EVENT_MTS * (1 + NAME_LEN)) + 3U + \
129 1 + 255 + 1U + 1 + 1U + \
141#define MAX_COMMIT_TIMESTAMP_VALUE (1ULL << 55)
152#define LOG_EVENT_IGNORABLE_F 0x80
173 unsigned char split_versions[3]) {
176 unsigned long number;
177 for (
unsigned int i = 0; i <= 2; i++) {
178 number = strtoul(
p, &
r, 10);
183 if (number < 256 && (*
r ==
'.' || i != 0))
184 split_versions[i] =
static_cast<unsigned char>(number);
186 split_versions[0] = 0;
187 split_versions[1] = 0;
188 split_versions[2] = 0;
205 unsigned char version_split[3];
207 uint32_t ret =
static_cast<uint32_t
>(version_split[0]) * 10000 +
208 static_cast<uint32_t
>(version_split[1]) * 100 +
209 static_cast<uint32_t
>(version_split[2]);
223 return ((version_split[0] * 256 + version_split[1]) * 256 + version_split[2]);
261#define LOG_EVENT_BINLOG_IN_USE_F 0x1
380#define ST_SERVER_VER_LEN 50
386#define EVENT_TYPE_OFFSET 4
387#define SERVER_ID_OFFSET 5
388#define EVENT_LEN_OFFSET 9
389#define LOG_POS_OFFSET 13
390#define FLAGS_OFFSET 17
393#define ST_BINLOG_VER_OFFSET 0
394#define ST_SERVER_VER_OFFSET 2
395#define ST_CREATED_OFFSET (ST_SERVER_VER_OFFSET + ST_SERVER_VER_LEN)
396#define ST_COMMON_HEADER_LEN_OFFSET (ST_CREATED_OFFSET + 4)
398#define LOG_EVENT_HEADER_LEN 19U
407#define LOG_EVENT_MINIMAL_HEADER_LEN 19U
429#define CHECKSUM_CRC32_SIGNATURE_LEN 4
434#define BINLOG_CHECKSUM_LEN CHECKSUM_CRC32_SIGNATURE_LEN
435#define BINLOG_CHECKSUM_ALG_DESC_LEN 1
436#define LOG_EVENT_HEADER_SIZE 20
457class Format_description_event;
877 virtual void print_event_info(std::ostream &
info) = 0;
881 virtual void print_long_info(std::ostream &
info) = 0;
946 void print_event_info(std::ostream &
info)
override;
947 void print_long_info(std::ostream &
info)
override;
#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:380
This is the abstract base class for binary log events.
Definition: binlog_event.h:798
Event_reader & reader()
Returns a reference to the event Event_reader object.
Definition: binlog_event.h:914
Log_event_footer * footer()
Return a non-const pointer to the footer of the log event.
Definition: binlog_event.h:910
Event_reader m_reader
Definition: binlog_event.h:921
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:849
const Log_event_header * header() const
Return a const pointer to the header of the log event.
Definition: binlog_event.h:898
Binary_log_event & operator=(Binary_log_event &&)=default
enum_post_header_length
The lengths for the fixed data part of each event.
Definition: binlog_event.h:811
@ XID_HEADER_LEN
Definition: binlog_event.h:826
@ TABLE_MAP_HEADER_LEN
Definition: binlog_event.h:829
@ IGNORABLE_HEADER_LEN
Definition: binlog_event.h:835
@ USER_VAR_HEADER_LEN
Definition: binlog_event.h:824
@ HEARTBEAT_HEADER_LEN
Definition: binlog_event.h:834
@ XA_PREPARE_HEADER_LEN
Definition: binlog_event.h:839
@ VIEW_CHANGE_HEADER_LEN
Definition: binlog_event.h:838
@ APPEND_BLOCK_HEADER_LEN
Definition: binlog_event.h:821
@ DELETE_FILE_HEADER_LEN
Definition: binlog_event.h:822
@ INTVAR_HEADER_LEN
Definition: binlog_event.h:820
@ INCIDENT_HEADER_LEN
Definition: binlog_event.h:833
@ EXECUTE_LOAD_QUERY_HEADER_LEN
Definition: binlog_event.h:831
@ QUERY_HEADER_MINIMAL_LEN
Definition: binlog_event.h:813
@ START_V3_HEADER_LEN
Definition: binlog_event.h:817
@ RAND_HEADER_LEN
Definition: binlog_event.h:823
@ QUERY_HEADER_LEN
Definition: binlog_event.h:815
@ ROWS_HEADER_LEN_V2
Definition: binlog_event.h:836
@ ROWS_HEADER_LEN_V1
Definition: binlog_event.h:828
@ TRANSACTION_PAYLOAD_HEADER_LEN
Definition: binlog_event.h:840
@ STOP_HEADER_LEN
Definition: binlog_event.h:816
@ TRANSACTION_CONTEXT_HEADER_LEN
Definition: binlog_event.h:837
@ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN
Definition: binlog_event.h:830
@ FORMAT_DESCRIPTION_HEADER_LEN
Definition: binlog_event.h:825
@ ROTATE_HEADER_LEN
Definition: binlog_event.h:819
@ BEGIN_LOAD_QUERY_HEADER_LEN
Definition: binlog_event.h:827
enum Log_event_type get_event_type() const
Helper method.
Definition: binlog_event.h:893
Binary_log_event(const Binary_log_event &)=default
Log_event_footer m_footer
Definition: binlog_event.h:923
static const int LOG_EVENT_TYPES
Definition: binlog_event.h:805
virtual ~Binary_log_event()=0
Log_event_header * header()
Return a non-const pointer to the header of the log event.
Definition: binlog_event.h:902
const Log_event_footer * footer() const
Return a const pointer to the footer of the log event.
Definition: binlog_event.h:906
Binary_log_event(Binary_log_event &&)=default
Log_event_header m_header
Definition: binlog_event.h:922
Binary_log_event & operator=(const Binary_log_event &)=default
Event_reader class purpose is to avoid out-of-buffer reads when deserializing binary log events and i...
Definition: event_reader.h:73
An unknown event should never occur.
Definition: binlog_event.h:936
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:942
const char * p
Definition: ctype-mb.cc:1236
This header file contains the status of variables used by MySQL tests for debug operations.
char * pos
Definition: do_ctype.cc:76
Contains the class responsible for deserializing fields of an event previously stored in a buffer.
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
const unsigned char checksum_version_split[3]
Replication event checksum is introduced in the following "checksum-home" version.
Definition: binlog_event.cpp:29
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:172
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:146
const int64_t SEQ_UNINIT
Uninitialized timestamp value (for either last committed or sequence number).
Definition: binlog_event.h:138
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:222
const uint32_t UNKNOWN_SERVER_VERSION
Definition: binlog_event.h:149
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:204
const unsigned long checksum_version_product
Definition: binlog_event.cpp:30
#define MAX_COMMIT_TIMESTAMP_VALUE
We use 7 bytes, 1 bit being used as a flag.
Definition: binlog_event.h:141
const uint32_t UNDEFINED_SERVER_VERSION
Definition: binlog_event.h:148
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:116
Common #defines and includes for file and socket I/O.
The namespace contains classes representing events that can occur in a replication stream.
enum_binlog_checksum_alg
Enumeration spcifying checksum algorithm used to encode a binary log event.
Definition: binlog_event.h:412
@ BINLOG_CHECKSUM_ALG_ENUM_END
the cut line: valid alg range is [1, 0x7f]
Definition: binlog_event.h:421
@ BINLOG_CHECKSUM_ALG_CRC32
CRC32 of zlib algorithm.
Definition: binlog_event.h:419
@ BINLOG_CHECKSUM_ALG_UNDEF
Special value to tag undetermined yet checksum or events from checksum-unaware servers.
Definition: binlog_event.h:426
@ BINLOG_CHECKSUM_ALG_OFF
Events are without checksum though its generator is checksum-capable New Master (NM).
Definition: binlog_event.h:417
Log_event_type
Enumeration type for the different types of log events.
Definition: binlog_event.h:266
@ EXECUTE_LOAD_QUERY_EVENT
Definition: binlog_event.h:295
@ TABLE_MAP_EVENT
Definition: binlog_event.h:297
@ XA_PREPARE_LOG_EVENT
Definition: binlog_event.h:341
@ WRITE_ROWS_EVENT_V1
The V1 event numbers are used from 5.1.16 until mysql-5.6.
Definition: binlog_event.h:302
@ HEARTBEAT_LOG_EVENT_V2
Definition: binlog_event.h:351
@ USER_VAR_EVENT
Definition: binlog_event.h:291
@ DELETE_ROWS_EVENT
Definition: binlog_event.h:329
@ 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:323
@ DELETE_ROWS_EVENT_V1
Definition: binlog_event.h:304
@ FORMAT_DESCRIPTION_EVENT
Definition: binlog_event.h:292
@ PREVIOUS_GTIDS_LOG_EVENT
Definition: binlog_event.h:334
@ SLAVE_EVENT
Definition: binlog_event.h:285
@ DELETE_FILE_EVENT
Definition: binlog_event.h:288
@ UNKNOWN_EVENT
Every time you add a type, you have to.
Definition: binlog_event.h:274
@ RAND_EVENT
Definition: binlog_event.h:290
@ TRANSACTION_PAYLOAD_EVENT
Definition: binlog_event.h:349
@ TRANSACTION_CONTEXT_EVENT
Definition: binlog_event.h:336
@ INCIDENT_EVENT
Something out of the ordinary happened on the master.
Definition: binlog_event.h:309
@ PARTIAL_UPDATE_ROWS_EVENT
Extension of UPDATE_ROWS_EVENT, allowing partial values according to binlog_row_value_options.
Definition: binlog_event.h:347
@ ROWS_QUERY_LOG_EVENT
Definition: binlog_event.h:324
@ GTID_LOG_EVENT
Definition: binlog_event.h:331
@ WRITE_ROWS_EVENT
Version 2 of the Row events.
Definition: binlog_event.h:327
@ UPDATE_ROWS_EVENT_V1
Definition: binlog_event.h:303
@ ANONYMOUS_GTID_LOG_EVENT
Definition: binlog_event.h:332
@ 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:315
@ ROTATE_EVENT
Definition: binlog_event.h:282
@ BEGIN_LOAD_QUERY_EVENT
Definition: binlog_event.h:294
@ ENUM_END_EVENT
Add new events here - right above this comment! Existing events (except ENUM_END_EVENT) should never ...
Definition: binlog_event.h:356
@ INTVAR_EVENT
Definition: binlog_event.h:283
@ UPDATE_ROWS_EVENT
Definition: binlog_event.h:328
@ APPEND_BLOCK_EVENT
Definition: binlog_event.h:287
@ VIEW_CHANGE_EVENT
Definition: binlog_event.h:338
@ XID_EVENT
Definition: binlog_event.h:293
@ STOP_EVENT
Definition: binlog_event.h:281
@ START_EVENT_V3
Definition: binlog_event.h:279
@ QUERY_EVENT
Definition: binlog_event.h:280
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:447
Definition: buf0block_hint.cc:29
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:75
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:94
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:85
required uint64 version
Definition: replication_group_member_actions.proto:40
Struct to pass basic information about a event: type, query, is it ignorable.
Definition: binlog_event.h:362
const char * query
Definition: binlog_event.h:364
Log_event_type event_type
Definition: binlog_event.h:363
bool ignorable_event
Definition: binlog_event.h:366
size_t query_length
Definition: binlog_event.h:365
#define BAPI_ASSERT(x)
Definition: wrapper_functions.h:61