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
118#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)
125#define MAX_SIZE_LOG_EVENT_STATUS \
126 (1U + 4 + 1U + 8 + 1U + 1 + \
127 255 + 1U + 4 + 1U + \
129 MAX_TIME_ZONE_NAME_LENGTH + 1U + \
135 (MAX_DBS_IN_EVENT_MTS * (1 + NAME_LEN)) \
136 + 1U + 3 + 1U + 1 + \
149#define MAX_COMMIT_TIMESTAMP_VALUE (1ULL << 55)
160#define LOG_EVENT_IGNORABLE_F 0x80
181 unsigned char split_versions[3]) {
184 unsigned long number;
185 for (
unsigned int i = 0; i <= 2; i++) {
186 number = strtoul(
p, &
r, 10);
191 if (number < 256 && (*
r ==
'.' || i != 0))
192 split_versions[i] =
static_cast<unsigned char>(number);
194 split_versions[0] = 0;
195 split_versions[1] = 0;
196 split_versions[2] = 0;
213 unsigned char version_split[3];
215 uint32_t ret =
static_cast<uint32_t
>(version_split[0]) * 10000 +
216 static_cast<uint32_t
>(version_split[1]) * 100 +
217 static_cast<uint32_t
>(version_split[2]);
231 return ((version_split[0] * 256 + version_split[1]) * 256 + version_split[2]);
269#define LOG_EVENT_BINLOG_IN_USE_F 0x1
388#define ST_SERVER_VER_LEN 50
394#define EVENT_TYPE_OFFSET 4
395#define SERVER_ID_OFFSET 5
396#define EVENT_LEN_OFFSET 9
397#define LOG_POS_OFFSET 13
398#define FLAGS_OFFSET 17
401#define ST_BINLOG_VER_OFFSET 0
402#define ST_SERVER_VER_OFFSET 2
403#define ST_CREATED_OFFSET (ST_SERVER_VER_OFFSET + ST_SERVER_VER_LEN)
404#define ST_COMMON_HEADER_LEN_OFFSET (ST_CREATED_OFFSET + 4)
406#define LOG_EVENT_HEADER_LEN 19U
415#define LOG_EVENT_MINIMAL_HEADER_LEN 19U
437#define CHECKSUM_CRC32_SIGNATURE_LEN 4
442#define BINLOG_CHECKSUM_LEN CHECKSUM_CRC32_SIGNATURE_LEN
443#define BINLOG_CHECKSUM_ALG_DESC_LEN 1
444#define LOG_EVENT_HEADER_SIZE 20
465class Format_description_event;
885 virtual void print_event_info(std::ostream &
info) = 0;
889 virtual void print_long_info(std::ostream &
info) = 0;
954 void print_event_info(std::ostream &
info)
override;
955 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:388
This is the abstract base class for binary log events.
Definition: binlog_event.h:806
Event_reader & reader()
Returns a reference to the event Event_reader object.
Definition: binlog_event.h:922
Log_event_footer * footer()
Return a non-const pointer to the footer of the log event.
Definition: binlog_event.h:918
Event_reader m_reader
Definition: binlog_event.h:929
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:857
const Log_event_header * header() const
Return a const pointer to the header of the log event.
Definition: binlog_event.h:906
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:819
@ XID_HEADER_LEN
Definition: binlog_event.h:834
@ TABLE_MAP_HEADER_LEN
Definition: binlog_event.h:837
@ IGNORABLE_HEADER_LEN
Definition: binlog_event.h:843
@ USER_VAR_HEADER_LEN
Definition: binlog_event.h:832
@ HEARTBEAT_HEADER_LEN
Definition: binlog_event.h:842
@ XA_PREPARE_HEADER_LEN
Definition: binlog_event.h:847
@ VIEW_CHANGE_HEADER_LEN
Definition: binlog_event.h:846
@ APPEND_BLOCK_HEADER_LEN
Definition: binlog_event.h:829
@ DELETE_FILE_HEADER_LEN
Definition: binlog_event.h:830
@ INTVAR_HEADER_LEN
Definition: binlog_event.h:828
@ INCIDENT_HEADER_LEN
Definition: binlog_event.h:841
@ EXECUTE_LOAD_QUERY_HEADER_LEN
Definition: binlog_event.h:839
@ QUERY_HEADER_MINIMAL_LEN
Definition: binlog_event.h:821
@ START_V3_HEADER_LEN
Definition: binlog_event.h:825
@ RAND_HEADER_LEN
Definition: binlog_event.h:831
@ QUERY_HEADER_LEN
Definition: binlog_event.h:823
@ ROWS_HEADER_LEN_V2
Definition: binlog_event.h:844
@ ROWS_HEADER_LEN_V1
Definition: binlog_event.h:836
@ TRANSACTION_PAYLOAD_HEADER_LEN
Definition: binlog_event.h:848
@ STOP_HEADER_LEN
Definition: binlog_event.h:824
@ TRANSACTION_CONTEXT_HEADER_LEN
Definition: binlog_event.h:845
@ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN
Definition: binlog_event.h:838
@ FORMAT_DESCRIPTION_HEADER_LEN
Definition: binlog_event.h:833
@ ROTATE_HEADER_LEN
Definition: binlog_event.h:827
@ BEGIN_LOAD_QUERY_HEADER_LEN
Definition: binlog_event.h:835
enum Log_event_type get_event_type() const
Helper method.
Definition: binlog_event.h:901
Binary_log_event(const Binary_log_event &)=default
Log_event_footer m_footer
Definition: binlog_event.h:931
static const int LOG_EVENT_TYPES
Definition: binlog_event.h:813
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:910
const Log_event_footer * footer() const
Return a const pointer to the footer of the log event.
Definition: binlog_event.h:914
Binary_log_event(Binary_log_event &&)=default
Log_event_header m_header
Definition: binlog_event.h:930
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:944
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:950
const char * p
Definition: ctype-mb.cc:1236
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.
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:180
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:154
const int64_t SEQ_UNINIT
Uninitialized timestamp value (for either last committed or sequence number).
Definition: binlog_event.h:146
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:230
const uint32_t UNKNOWN_SERVER_VERSION
Definition: binlog_event.h:157
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:212
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:149
const uint32_t UNDEFINED_SERVER_VERSION
Definition: binlog_event.h:156
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:420
@ BINLOG_CHECKSUM_ALG_ENUM_END
the cut line: valid alg range is [1, 0x7f]
Definition: binlog_event.h:429
@ BINLOG_CHECKSUM_ALG_CRC32
CRC32 of zlib algorithm.
Definition: binlog_event.h:427
@ BINLOG_CHECKSUM_ALG_UNDEF
Special value to tag undetermined yet checksum or events from checksum-unaware servers.
Definition: binlog_event.h:434
@ BINLOG_CHECKSUM_ALG_OFF
Events are without checksum though its generator is checksum-capable New Master (NM).
Definition: binlog_event.h:425
Log_event_type
Enumeration type for the different types of log events.
Definition: binlog_event.h:274
@ EXECUTE_LOAD_QUERY_EVENT
Definition: binlog_event.h:303
@ TABLE_MAP_EVENT
Definition: binlog_event.h:305
@ XA_PREPARE_LOG_EVENT
Definition: binlog_event.h:349
@ WRITE_ROWS_EVENT_V1
The V1 event numbers are used from 5.1.16 until mysql-5.6.
Definition: binlog_event.h:310
@ HEARTBEAT_LOG_EVENT_V2
Definition: binlog_event.h:359
@ USER_VAR_EVENT
Definition: binlog_event.h:299
@ DELETE_ROWS_EVENT
Definition: binlog_event.h:337
@ 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:331
@ DELETE_ROWS_EVENT_V1
Definition: binlog_event.h:312
@ FORMAT_DESCRIPTION_EVENT
Definition: binlog_event.h:300
@ PREVIOUS_GTIDS_LOG_EVENT
Definition: binlog_event.h:342
@ SLAVE_EVENT
Definition: binlog_event.h:293
@ DELETE_FILE_EVENT
Definition: binlog_event.h:296
@ UNKNOWN_EVENT
Every time you add a type, you have to.
Definition: binlog_event.h:282
@ RAND_EVENT
Definition: binlog_event.h:298
@ TRANSACTION_PAYLOAD_EVENT
Definition: binlog_event.h:357
@ TRANSACTION_CONTEXT_EVENT
Definition: binlog_event.h:344
@ INCIDENT_EVENT
Something out of the ordinary happened on the master.
Definition: binlog_event.h:317
@ PARTIAL_UPDATE_ROWS_EVENT
Extension of UPDATE_ROWS_EVENT, allowing partial values according to binlog_row_value_options.
Definition: binlog_event.h:355
@ ROWS_QUERY_LOG_EVENT
Definition: binlog_event.h:332
@ GTID_LOG_EVENT
Definition: binlog_event.h:339
@ WRITE_ROWS_EVENT
Version 2 of the Row events.
Definition: binlog_event.h:335
@ UPDATE_ROWS_EVENT_V1
Definition: binlog_event.h:311
@ ANONYMOUS_GTID_LOG_EVENT
Definition: binlog_event.h:340
@ 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:323
@ ROTATE_EVENT
Definition: binlog_event.h:290
@ BEGIN_LOAD_QUERY_EVENT
Definition: binlog_event.h:302
@ ENUM_END_EVENT
Add new events here - right above this comment! Existing events (except ENUM_END_EVENT) should never ...
Definition: binlog_event.h:364
@ INTVAR_EVENT
Definition: binlog_event.h:291
@ UPDATE_ROWS_EVENT
Definition: binlog_event.h:336
@ APPEND_BLOCK_EVENT
Definition: binlog_event.h:295
@ VIEW_CHANGE_EVENT
Definition: binlog_event.h:346
@ XID_EVENT
Definition: binlog_event.h:301
@ STOP_EVENT
Definition: binlog_event.h:289
@ START_EVENT_V3
Definition: binlog_event.h:287
@ QUERY_EVENT
Definition: binlog_event.h:288
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:455
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:370
const char * query
Definition: binlog_event.h:372
Log_event_type event_type
Definition: binlog_event.h:371
bool ignorable_event
Definition: binlog_event.h:374
size_t query_length
Definition: binlog_event.h:373
#define BAPI_ASSERT(x)
Definition: wrapper_functions.h:61