MySQL 8.0.39
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... | |
virtual std::int64_t | get_gno () const |
Uuid | get_uuid () 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... | |
Public Member Functions inherited from binary_log::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 Attributes | |
long long int | last_committed |
long long int | 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 long long int | original_commit_timestamp |
Timestamp when the transaction was committed on the originating master. More... | |
unsigned long long int | immediate_commit_timestamp |
Timestamp when the transaction was committed on the nearest master. More... | |
bool | has_commit_timestamps |
unsigned long long int | 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 const int | MAX_DATA_LENGTH |
static const int | MAX_EVENT_LENGTH |
Static Public Attributes inherited from binary_log::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 binary_log::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 Attributes | |
gtid_info | gtid_info_struct |
Uuid | Uuid_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... | |
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 |
binary_log::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.
int binary_log::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.
commit_group_ticket
field
|
inlineprotected |
|
inlinevirtual |
Reimplemented in Gtid_log_event.
|
inlineprotected |
We only store the immediate_server_version if both server versions are the same.
|
inline |
transaction_length
field.
|
inline |
void binary_log::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. |
std::uint64_t binary_log::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 binary_log::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.
|
protected |
bool binary_log::Gtid_event::has_commit_timestamps |
unsigned long long int binary_log::Gtid_event::immediate_commit_timestamp |
Timestamp when the transaction was committed on the nearest master.
|
staticprotected |
uint32_t binary_log::Gtid_event::immediate_server_version |
The version of the immediate server.
|
staticprotected |
Length of immediate_server_version.
|
staticconstexpr |
long long int binary_log::Gtid_event::last_committed |
|
staticprotected |
Length of two logical timestamps.
|
staticprotected |
|
staticprotected |
Length of typecode for logical timestamps.
|
static |
|
static |
bool binary_log::Gtid_event::may_have_sbr_stmts |
Transaction might have changes logged with SBR.
|
staticprotected |
unsigned long long int binary_log::Gtid_event::original_commit_timestamp |
Timestamp when the transaction was committed on the originating master.
|
staticprotected |
uint32_t binary_log::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.
long long int binary_log::Gtid_event::sequence_number |
unsigned long long int binary_log::Gtid_event::transaction_length |
The length of the transaction in bytes.
|
staticprotected |
|
staticprotected |
|
protected |