MySQL 9.1.0
Source Code Documentation
|
GTID stands for Global Transaction IDentifier It is composed of two parts: More...
#include <control_events.h>
Public Member Functions | |
Gtid_event (const char *buf, const Format_description_event *fde) | |
Ctor of Gtid_event. More... | |
Gtid_event (long long int last_committed_arg, long long int sequence_number_arg, bool may_have_sbr_stmts_arg, unsigned long long int original_commit_timestamp_arg, unsigned long long int immediate_commit_timestamp_arg, uint32_t original_server_version_arg, uint32_t immediate_server_version_arg) | |
Constructor. More... | |
decltype(auto) | define_fields () |
decltype(auto) | define_fields () const |
void | read_gtid_tagged_log_event (const char *buf, std::size_t buf_size) |
Function that reads GTID_TAGGED_LOG_EVENT event type from the given buffer. More... | |
void | update_untagged_transaction_length () |
Updates transaction length which was not yet considered. More... | |
void | update_tagged_transaction_length (std::size_t trx_len_without_event_len) |
Updated transaction length based on transaction length without event length. More... | |
virtual std::int64_t | get_gno () const |
mysql::gtid::Tsid | get_tsid () const |
Tag_plain | generate_tag_specification () const |
void | set_trx_length (unsigned long long int transaction_length_arg) |
Set the transaction length information. More... | |
unsigned long long | get_trx_length () const |
int | get_commit_group_ticket_length () const |
Returns the length of the packed commit_group_ticket field. More... | |
void | set_commit_group_ticket_and_update_transaction_length (std::uint64_t value) |
Set the commit_group_ticket and update the transaction length if needed, that is, if the commit_group_ticket was not set already account it on the transaction size. More... | |
bool | is_tagged () const |
Checks whether this Gtid log event contains a tag. More... | |
Public Member Functions inherited from mysql::binlog::event::Binary_log_event | |
virtual | ~Binary_log_event ()=0 |
Binary_log_event (const Binary_log_event &)=default | |
Binary_log_event (Binary_log_event &&)=default | |
Binary_log_event & | operator= (const Binary_log_event &)=default |
Binary_log_event & | operator= (Binary_log_event &&)=default |
enum Log_event_type | get_event_type () const |
Helper method. More... | |
const Log_event_header * | header () const |
Return a const pointer to the header of the log event. More... | |
Log_event_header * | header () |
Return a non-const pointer to the header of the log event. More... | |
const Log_event_footer * | footer () const |
Return a const pointer to the footer of the log event. More... | |
Log_event_footer * | footer () |
Return a non-const pointer to the footer of the log event. More... | |
Event_reader & | reader () |
Returns a reference to the event Event_reader object. More... | |
Public Member Functions inherited from mysql::serialization::Serializable< Gtid_event > | |
void | do_for_each_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f) |
calls functor for each field More... | |
void | do_for_each_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f) const |
calls functor for each field, const version More... | |
std::size_t | get_size_internal () const |
Returns serializable object fields size, internal function (without serializable metadata size) More... | |
bool | is_any_field_provided () const |
Performs iteration over all of the serializable fields and checks whether any of the fields in this serializable is provided. More... | |
void | set_unknown_field_policy (const Unknown_field_policy &policy) |
Sets unknown field policy for this object. More... | |
bool | is_ignorable () const |
Static Public Member Functions | |
static constexpr std::size_t | get_max_event_length () |
Get maximum size of event. More... | |
static constexpr std::size_t | get_max_payload_size () |
Get maximum size of event payload. More... | |
Static Public Member Functions inherited from mysql::serialization::Serializable< Gtid_event > | |
static constexpr Field_id_type | get_last_field_id () |
This function calculates last field id of this type. More... | |
static constexpr std::size_t | get_max_size_internal () |
Returns serializable object fields maximum size, internal function (without serializable metadata size) More... | |
Public Attributes | |
int64_t | last_committed |
int64_t | sequence_number |
unsigned const char | FLAG_MAY_HAVE_SBR = 1 |
GTID flags constants. More... | |
bool | may_have_sbr_stmts |
Transaction might have changes logged with SBR. More... | |
unsigned char | gtid_flags = 0 |
GTID flags, used bits: More... | |
uint64_t | original_commit_timestamp |
Timestamp when the transaction was committed on the originating source. More... | |
uint64_t | immediate_commit_timestamp |
Timestamp when the transaction was committed on the nearest source. More... | |
bool | has_commit_timestamps |
Flag indicating whether this event contains commit timestamps. More... | |
uint64_t | transaction_length |
The length of the transaction in bytes. More... | |
uint32_t | original_server_version |
The version of the server where the transaction was originally executed. More... | |
uint32_t | immediate_server_version |
The version of the immediate server. More... | |
std::uint64_t | commit_group_ticket {kGroupTicketUnset} |
Ticket number used to group sessions together during the BGC. More... | |
Static Public Attributes | |
static constexpr int | COMMIT_GROUP_TICKET_LENGTH = 8 |
static constexpr std::uint64_t | kGroupTicketUnset = 0 |
static const int | POST_HEADER_LENGTH |
Total length of post header. More... | |
Static Public Attributes inherited from mysql::binlog::event::Binary_log_event | |
static const int | LOG_EVENT_TYPES = (ENUM_END_EVENT - 1) |
Protected Member Functions | |
int | get_commit_timestamp_length () const |
int | get_server_version_length () const |
We only store the immediate_server_version if both server versions are the same. More... | |
Protected Member Functions inherited from mysql::binlog::event::Binary_log_event | |
Binary_log_event (Log_event_type type_code) | |
This constructor is used to initialize the type_code of header object m_header. More... | |
Binary_log_event (const char **buf, const Format_description_event *fde) | |
This constructor will create a new object of Log_event_header and initialize the variable m_header, which in turn will be used to initialize Log_event's member common_header. More... | |
Protected Member Functions inherited from mysql::serialization::Serializable< Gtid_event > | |
Serializable ()=default | |
Serializable (const Serializable &)=default | |
Serializable (Serializable &&)=default | |
void | do_for_each_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f, Tuple_type &&tuple, std::index_sequence< Is... >) |
do_for_each_field helper More... | |
void | do_for_each_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f, Tuple_type &&tuple, std::index_sequence< Is... >) const |
do_for_each_field (const) helper More... | |
void | do_for_one_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f, Field_type &field, std::size_t field_id) |
do_for_each_field helper More... | |
void | do_for_one_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f, Field_type &field, std::size_t field_id, Serializable_tag) |
do_for_each_field helper More... | |
void | do_for_one_field (Serializable_functor_type &&, Field_functor_type &&func_f, Field_type &field, std::size_t field_id, Field_definition_tag) |
do_for_each_field helper More... | |
void | do_for_one_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f, const Field_type &field, std::size_t field_id) const |
do_for_each_field (const) helper More... | |
void | do_for_one_field (Serializable_functor_type &&func_s, Field_functor_type &&func_f, const Field_type &field, std::size_t field_id, Serializable_tag) const |
do_for_each_field (const) helper More... | |
void | do_for_one_field (Serializable_functor_type &&, Field_functor_type &&func_f, const Field_type &field, std::size_t field_id, Field_definition_tag) const |
do_for_each_field (const) helper More... | |
Serializable & | operator= (const Serializable &)=default |
Serializable & | operator= (Serializable &&)=default |
virtual | ~Serializable ()=default |
Creation of Serializable objects is prohibited. More... | |
Protected Attributes | |
gtid_info | gtid_info_struct |
mysql::gtid::Tsid | tsid_parent_struct |
Static Protected Attributes | |
static const int | ENCODED_FLAG_LENGTH = 1 |
static const int | ENCODED_SID_LENGTH = 16 |
static const int | ENCODED_GNO_LENGTH = 8 |
static const int | LOGICAL_TIMESTAMP_TYPECODE_LENGTH = 1 |
Length of typecode for logical timestamps. More... | |
static const int | LOGICAL_TIMESTAMP_LENGTH = 16 |
Length of two logical timestamps. More... | |
static const int | LOGICAL_TIMESTAMP_TYPECODE = 2 |
static const int | IMMEDIATE_COMMIT_TIMESTAMP_LENGTH = 7 |
static const int | ORIGINAL_COMMIT_TIMESTAMP_LENGTH = 7 |
static const int | FULL_COMMIT_TIMESTAMP_LENGTH |
static const int | ENCODED_COMMIT_TIMESTAMP_LENGTH = 55 |
static const int | TRANSACTION_LENGTH_MIN_LENGTH = 1 |
static const int | TRANSACTION_LENGTH_MAX_LENGTH = 9 |
static const int | ORIGINAL_SERVER_VERSION_LENGTH = 4 |
Length of original_server_version. More... | |
static const int | IMMEDIATE_SERVER_VERSION_LENGTH = 4 |
Length of immediate_server_version. More... | |
static const int | FULL_SERVER_VERSION_LENGTH |
Length of original and immediate server version. More... | |
static const int | ENCODED_SERVER_VERSION_LENGTH = 31 |
static const int64_t | MIN_GNO = 1 |
static const std::int64_t | GNO_END = INT64_MAX |
One-past-the-max value of GNO. More... | |
Static Private Attributes | |
static const int | MAX_DATA_LENGTH |
Additional Inherited Members | |
Protected Types inherited from mysql::serialization::Serializable< Gtid_event > | |
using | Tag = Serializable_tag |
GTID stands for Global Transaction IDentifier It is composed of two parts:
The Body can have up to nine components:
Name | Format | Description |
---|---|---|
GTID_FLAGS | 1 byte | 00000001 = Transaction may have changes logged with SBR. In 5.6, 5.7.0-5.7.18, and 8.0.0-8.0.1, this flag is always set. Starting in 5.7.19 and 8.0.2, this flag is cleared if the transaction only contains row events. It is set if any part of the transaction is written in statement format. |
SID | 16 byte sequence | UUID representing the SID |
GNO | 8 byte integer | Group number, second component of GTID. |
logical clock timestamp typecode | 1 byte integer | The type of logical timestamp used in the logical clock fields. |
last_committed | 8 byte integer | Store the transaction's commit parent sequence_number |
sequence_number | 8 byte integer | The transaction's logical timestamp assigned at prepare phase |
immediate_commit_timestamp | 7 byte integer | Timestamp of commit on the immediate master |
original_commit_timestamp | 7 byte integer | Timestamp of commit on the originating master |
transaction_length | 1 to 9 byte integer // See net_length_size(ulonglong num) | The packed transaction's length in bytes, including the Gtid |
immediate_server_version | 4 byte integer | Server version of the immediate server |
original_server_version | 4 byte integer | Version of the server where the transaction was originally executed |
using mysql::binlog::event::Gtid_event::Decoder_type = mysql::serialization::Serializer_default<Read_archive_type> |
using mysql::binlog::event::Gtid_event::Encoder_type = mysql::serialization::Serializer_default<Write_archive_type> |
using mysql::binlog::event::Gtid_event::Field_encode_predicate = mysql::serialization::Field_encode_predicate |
using mysql::binlog::event::Gtid_event::Field_missing_functor = mysql::serialization::Field_missing_functor |
using mysql::binlog::event::Gtid_event::Read_archive_type = mysql::serialization::Read_archive_binary |
using mysql::binlog::event::Gtid_event::Write_archive_type = mysql::serialization::Write_archive_binary |
mysql::binlog::event::Gtid_event::Gtid_event | ( | const char * | buf, |
const Format_description_event * | fde | ||
) |
Ctor of Gtid_event.
The layout of the buffer is as follows
+----------+---+---+-------+--------------+---------+----------+ |gtid flags|SID|GNO|TS_TYPE|logical ts(:s)|commit ts|trx length| +----------+---+---+-------+------------------------+----------+
TS_TYPE is from {G_COMMIT_TS2} singleton set of values Details on commit timestamps in Gtid_event(const char*...)
buf | Contains the serialized event. |
fde | An FDE event (see Rotate_event constructor for more info). |
Fetch the original/immediate_server_version. Set it to UNDEFINED_SERVER_VERSION if no version can be fetched.
|
inlineexplicit |
Constructor.
|
inline |
|
inline |
|
inline |
int mysql::binlog::event::Gtid_event::get_commit_group_ticket_length | ( | ) | const |
Returns the length of the packed commit_group_ticket
field.
It may be 8 bytes or 0 bytes, depending on whether or not the value is instantiated. This function may be used only for untagged GTID events
commit_group_ticket
field
|
inlineprotected |
|
inlinevirtual |
Reimplemented in Gtid_log_event.
|
inlinestaticconstexpr |
Get maximum size of event.
|
inlinestaticconstexpr |
Get maximum size of event payload.
|
inlineprotected |
We only store the immediate_server_version if both server versions are the same.
|
inline |
|
inline |
bool mysql::binlog::event::Gtid_event::is_tagged | ( | ) | const |
Checks whether this Gtid log event contains a tag.
void mysql::binlog::event::Gtid_event::read_gtid_tagged_log_event | ( | const char * | buf, |
std::size_t | buf_size | ||
) |
Function that reads GTID_TAGGED_LOG_EVENT event type from the given buffer.
buf | Buffer to read from |
buf_size | Number of bytes in the buffer |
void mysql::binlog::event::Gtid_event::set_commit_group_ticket_and_update_transaction_length | ( | std::uint64_t | value | ) |
Set the commit_group_ticket and update the transaction length if needed, that is, if the commit_group_ticket was not set already account it on the transaction size.
value | The commit_group_ticket value. |
|
inline |
Set the transaction length information.
This function should be used when the full transaction length (including the Gtid event length) is known.
transaction_length_arg | The transaction length. |
void mysql::binlog::event::Gtid_event::update_tagged_transaction_length | ( | std::size_t | trx_len_without_event_len | ) |
Updated transaction length based on transaction length without event length.
[in] | trx_len_without_event_len | Transaction length without event body length |
void mysql::binlog::event::Gtid_event::update_untagged_transaction_length | ( | ) |
Updates transaction length which was not yet considered.
std::uint64_t mysql::binlog::event::Gtid_event::commit_group_ticket {kGroupTicketUnset} |
Ticket number used to group sessions together during the BGC.
|
staticconstexpr |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
unsigned const char mysql::binlog::event::Gtid_event::FLAG_MAY_HAVE_SBR = 1 |
GTID flags constants.
|
staticprotected |
|
staticprotected |
Length of original and immediate server version.
|
staticprotected |
One-past-the-max value of GNO.
unsigned char mysql::binlog::event::Gtid_event::gtid_flags = 0 |
GTID flags, used bits:
|
protected |
bool mysql::binlog::event::Gtid_event::has_commit_timestamps |
Flag indicating whether this event contains commit timestamps.
uint64_t mysql::binlog::event::Gtid_event::immediate_commit_timestamp |
Timestamp when the transaction was committed on the nearest source.
|
staticprotected |
uint32_t mysql::binlog::event::Gtid_event::immediate_server_version |
The version of the immediate server.
|
staticprotected |
Length of immediate_server_version.
|
staticconstexpr |
int64_t mysql::binlog::event::Gtid_event::last_committed |
|
staticprotected |
Length of two logical timestamps.
|
staticprotected |
|
staticprotected |
Length of typecode for logical timestamps.
|
staticprivate |
bool mysql::binlog::event::Gtid_event::may_have_sbr_stmts |
Transaction might have changes logged with SBR.
|
staticprotected |
uint64_t mysql::binlog::event::Gtid_event::original_commit_timestamp |
Timestamp when the transaction was committed on the originating source.
|
staticprotected |
uint32_t mysql::binlog::event::Gtid_event::original_server_version |
The version of the server where the transaction was originally executed.
|
staticprotected |
Length of original_server_version.
|
static |
Total length of post header.
int64_t mysql::binlog::event::Gtid_event::sequence_number |
uint64_t mysql::binlog::event::Gtid_event::transaction_length |
The length of the transaction in bytes.
|
staticprotected |
|
staticprotected |
|
protected |