MySQL 9.0.0
Source Code Documentation
MySQL Libraries : Binlog Event
Collaboration diagram for MySQL Libraries : Binlog Event:

Files

file  payload_event_buffer_istream.h
 Stream class that yields decompressed event byte buffers from a Transaction_payload_log_event.
 

Namespaces

namespace  mysql
 
namespace  mysql::binlog
 
namespace  mysql::binlog::event
 The namespace contains classes representing events that can occur in a replication stream.
 
namespace  mysql::binlog::event::compression
 
namespace  mysql::binlog::event::compression::buffer
 
namespace  mysql::binlog::event::math
 
namespace  mysql::binlog::event::resource
 
namespace  mysql::binlog::event::string
 
namespace  binary_log
 

Macros

#define SYSTEM_CHARSET_MBMAXLEN   3
 
#define NAME_CHAR_LEN   64 /* Field/table name length */
 
#define NAME_LEN   (NAME_CHAR_LEN * SYSTEM_CHARSET_MBMAXLEN)
 
#define ST_SERVER_VER_SPLIT_LEN   3
 
#define BIN_LOG_HEADER_SIZE   4U
 
#define BINLOG_VERSION   4
 binlog_version 3 is MySQL 4.x; 4 is MySQL 5.0.0. More...
 
#define MAX_DBS_IN_EVENT_MTS   16
 The maximum number of updated databases that a status of Query-log-event can carry. More...
 
#define OVER_MAX_DBS_IN_EVENT_MTS   254
 When the actual number of databases exceeds MAX_DBS_IN_EVENT_MTS the value of OVER_MAX_DBS_IN_EVENT_MTS is is put into the mts_accessed_dbs status. More...
 
#define MAX_TIME_ZONE_NAME_LENGTH   (NAME_LEN + 1)
 Maximum length of time zone name that we support (Time zone name is char(64) in db). More...
 
#define MAX_SIZE_LOG_EVENT_STATUS
 Max number of possible extra bytes in a replication event compared to a packet (i.e. More...
 
#define MAX_COMMIT_TIMESTAMP_VALUE   (1ULL << 55)
 We use 7 bytes, 1 bit being used as a flag. More...
 
#define LOG_EVENT_IGNORABLE_F   0x80
 Setting this flag will mark an event as Ignorable. More...
 
#define DUMPFILE_FLAG   0x1
 
#define OPT_ENCLOSED_FLAG   0x2
 
#define REPLACE_FLAG   0x4
 
#define IGNORE_FLAG   0x8
 
#define FIELD_TERM_EMPTY   0x1
 
#define ENCLOSED_EMPTY   0x2
 
#define LINE_TERM_EMPTY   0x4
 
#define LINE_START_EMPTY   0x8
 
#define ESCAPED_EMPTY   0x10
 
#define EXTRA_ROW_INFO_LEN_OFFSET   0
 1 byte length, 1 byte format Length is total length in bytes, including 2 byte header Length values 0 and 1 are currently invalid and reserved. More...
 
#define EXTRA_ROW_INFO_FORMAT_OFFSET   1
 
#define EXTRA_ROW_INFO_HEADER_LENGTH   2
 
#define EXTRA_ROW_INFO_MAX_PAYLOAD   (255 - EXTRA_ROW_INFO_HEADER_LENGTH)
 
#define ROWS_MAPID_OFFSET   0
 
#define ROWS_FLAGS_OFFSET   6
 
#define ROWS_VHLEN_OFFSET   8
 
#define EXTRA_ROW_INFO_TYPECODE_LENGTH   1
 
#define EXTRA_ROW_PART_INFO_VALUE_LENGTH   2
 

Enumerations

enum class  enum_extra_row_info_typecode { enum_extra_row_info_typecode::NDB = 0 , enum_extra_row_info_typecode::PART = 1 }
 This is the typecode defined for the different elements present in the container Extra_row_info, this is different from the format information stored inside extra_row_ndb_info at EXTRA_ROW_INFO_FORMAT_OFFSET. More...
 

Functions

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.h. More...
 
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. More...
 
unsigned long version_product (const unsigned char *version_split)
 Calculate the version product from the numeric pieces representing the server version: For a server version X.Y.Zabc (X,Y,Z numbers, a not a digit), the input is {X,Y,Z}. More...
 

Variables

const int64_t SEQ_UNINIT = 0
 Uninitialized timestamp value (for either last committed or sequence number). More...
 
const int64_t UNDEFINED_COMMIT_TIMESTAMP = MAX_COMMIT_TIMESTAMP_VALUE
 Used to determine whether the original_commit_timestamp is already known or if it still needs to be determined when computing it. More...
 
const uint32_t UNDEFINED_SERVER_VERSION = 999999
 
const uint32_t UNKNOWN_SERVER_VERSION = 0
 
const unsigned char checksum_version_split [3]
 Replication event checksum is introduced in the following "checksum-home" version. More...
 
const unsigned long checksum_version_product
 

Detailed Description

Macro Definition Documentation

◆ BIN_LOG_HEADER_SIZE

#define BIN_LOG_HEADER_SIZE   4U

◆ BINLOG_VERSION

#define BINLOG_VERSION   4

binlog_version 3 is MySQL 4.x; 4 is MySQL 5.0.0.

Compared to version 3, version 4 has:

  • a different Start_event, which includes info about the binary log (sizes of headers); this info is included for better compatibility if the master's MySQL version is different from the slave's.

◆ DUMPFILE_FLAG

#define DUMPFILE_FLAG   0x1

◆ ENCLOSED_EMPTY

#define ENCLOSED_EMPTY   0x2

◆ ESCAPED_EMPTY

#define ESCAPED_EMPTY   0x10

◆ EXTRA_ROW_INFO_FORMAT_OFFSET

#define EXTRA_ROW_INFO_FORMAT_OFFSET   1

◆ EXTRA_ROW_INFO_HEADER_LENGTH

#define EXTRA_ROW_INFO_HEADER_LENGTH   2

◆ EXTRA_ROW_INFO_LEN_OFFSET

#define EXTRA_ROW_INFO_LEN_OFFSET   0

1 byte length, 1 byte format Length is total length in bytes, including 2 byte header Length values 0 and 1 are currently invalid and reserved.

◆ EXTRA_ROW_INFO_MAX_PAYLOAD

#define EXTRA_ROW_INFO_MAX_PAYLOAD   (255 - EXTRA_ROW_INFO_HEADER_LENGTH)

◆ EXTRA_ROW_INFO_TYPECODE_LENGTH

#define EXTRA_ROW_INFO_TYPECODE_LENGTH   1

◆ EXTRA_ROW_PART_INFO_VALUE_LENGTH

#define EXTRA_ROW_PART_INFO_VALUE_LENGTH   2

◆ FIELD_TERM_EMPTY

#define FIELD_TERM_EMPTY   0x1

◆ IGNORE_FLAG

#define IGNORE_FLAG   0x8

◆ LINE_START_EMPTY

#define LINE_START_EMPTY   0x8

◆ LINE_TERM_EMPTY

#define LINE_TERM_EMPTY   0x4

◆ LOG_EVENT_IGNORABLE_F

#define LOG_EVENT_IGNORABLE_F   0x80

Setting this flag will mark an event as Ignorable.

◆ MAX_COMMIT_TIMESTAMP_VALUE

#define MAX_COMMIT_TIMESTAMP_VALUE   (1ULL << 55)

We use 7 bytes, 1 bit being used as a flag.

◆ MAX_DBS_IN_EVENT_MTS

#define MAX_DBS_IN_EVENT_MTS   16

The maximum number of updated databases that a status of Query-log-event can carry.

It can be redefined within a range [1.. OVER_MAX_DBS_IN_EVENT_MTS].

◆ MAX_SIZE_LOG_EVENT_STATUS

#define MAX_SIZE_LOG_EVENT_STATUS
Value:
(1U + 4 /* type, flags2 */ + 1U + 8 /* type, sql_mode */ + 1U + 1 + \
255 /* type, length, catalog */ + 1U + 4 /* type, auto_increment */ + 1U + \
6 /* type, charset */ + 1U + 1 + \
MAX_TIME_ZONE_NAME_LENGTH /* type, length, time_zone */ + 1U + \
2 /* type, lc_time_names_number */ + 1U + \
2 /* type, charset_database_number */ + 1U + \
8 /* type, table_map_for_update */ + 1U + 1 + \
32 * 3 /* type, user_len, user */ + 1 + 255 /* host_len, host */ \
+ 1U + 1 + \
(MAX_DBS_IN_EVENT_MTS * (1 + NAME_LEN)) /* type, db_1, db_2, ... */ \
+ 1U + 3 /* type, microseconds */ + 1U + 1 /* type, explicit_def..ts*/ + \
1U + 8 /* type, xid of DDL */ + 1U + \
2 /* type, default_collation_for_utf8mb4_number */ + 1U + \
1 /* sql_require_primary_key */ + 1U + \
1 /* type, default_table_encryption */)
#define NAME_LEN
Definition: binlog_event.h:84
#define MAX_DBS_IN_EVENT_MTS
The maximum number of updated databases that a status of Query-log-event can carry.
Definition: binlog_event.h:117

Max number of possible extra bytes in a replication event compared to a packet (i.e.

a query) sent from client to master; First, an auxiliary log_event status vars estimation:

◆ MAX_TIME_ZONE_NAME_LENGTH

#define MAX_TIME_ZONE_NAME_LENGTH   (NAME_LEN + 1)

Maximum length of time zone name that we support (Time zone name is char(64) in db).

mysqlbinlog needs it.

◆ NAME_CHAR_LEN

#define NAME_CHAR_LEN   64 /* Field/table name length */

◆ NAME_LEN

#define NAME_LEN   (NAME_CHAR_LEN * SYSTEM_CHARSET_MBMAXLEN)

◆ OPT_ENCLOSED_FLAG

#define OPT_ENCLOSED_FLAG   0x2

◆ OVER_MAX_DBS_IN_EVENT_MTS

#define OVER_MAX_DBS_IN_EVENT_MTS   254

When the actual number of databases exceeds MAX_DBS_IN_EVENT_MTS the value of OVER_MAX_DBS_IN_EVENT_MTS is is put into the mts_accessed_dbs status.

◆ REPLACE_FLAG

#define REPLACE_FLAG   0x4

◆ ROWS_FLAGS_OFFSET

#define ROWS_FLAGS_OFFSET   6

◆ ROWS_MAPID_OFFSET

#define ROWS_MAPID_OFFSET   0

◆ ROWS_VHLEN_OFFSET

#define ROWS_VHLEN_OFFSET   8

◆ ST_SERVER_VER_SPLIT_LEN

#define ST_SERVER_VER_SPLIT_LEN   3

◆ SYSTEM_CHARSET_MBMAXLEN

#define SYSTEM_CHARSET_MBMAXLEN   3

Enumeration Type Documentation

◆ enum_extra_row_info_typecode

enum class enum_extra_row_info_typecode
strong

This is the typecode defined for the different elements present in the container Extra_row_info, this is different from the format information stored inside extra_row_ndb_info at EXTRA_ROW_INFO_FORMAT_OFFSET.

Enumerator
NDB 
PART 

Function Documentation

◆ do_server_version_int()

uint32_t do_server_version_int ( const char *  version)
inline

Transforms the server version from 'XX.YY.ZZ-suffix' into an integer in the format XXYYZZ.

Parameters
versionString representing server version
Returns
The server version in the format XXYYZZ

◆ do_server_version_split()

void do_server_version_split ( const char *  version,
unsigned char  split_versions[3] 
)
inline

In case the variable is updated, make sure to update it in $MYSQL_SOURCE_DIR/my_io.h.

Splits server 'version' string into three numeric pieces stored into 'split_versions': X.Y.Zabc (X,Y,Z numbers, a not a digit) -> {X,Y,Z} X.Yabc -> {X,Y,0}

Parameters
versionString representing server version
split_versionsArray with each element containing one split of the input version string

◆ version_product()

unsigned long version_product ( const unsigned char *  version_split)
inline

Calculate the version product from the numeric pieces representing the server version: For a server version X.Y.Zabc (X,Y,Z numbers, a not a digit), the input is {X,Y,Z}.

This is converted to XYZ in bit representation.

Parameters
version_splitArray containing the version information of the server
Returns
The version product of the server

Variable Documentation

◆ checksum_version_product

const unsigned long checksum_version_product
extern

◆ checksum_version_split

const unsigned char checksum_version_split[3]
extern

Replication event checksum is introduced in the following "checksum-home" version.

The checksum-aware servers extract FD's version to decide whether the FD event carries checksum info.

◆ SEQ_UNINIT

const int64_t SEQ_UNINIT = 0

Uninitialized timestamp value (for either last committed or sequence number).

Often carries meaning of the minimum value in the logical timestamp domain.

◆ UNDEFINED_COMMIT_TIMESTAMP

const int64_t UNDEFINED_COMMIT_TIMESTAMP = MAX_COMMIT_TIMESTAMP_VALUE

Used to determine whether the original_commit_timestamp is already known or if it still needs to be determined when computing it.

◆ UNDEFINED_SERVER_VERSION

const uint32_t UNDEFINED_SERVER_VERSION = 999999

◆ UNKNOWN_SERVER_VERSION

const uint32_t UNKNOWN_SERVER_VERSION = 0