MySQL 8.4.2
Source Code Documentation
Gtid_log_event Class Reference

This is a subclass if Gtid_event and Log_event. More...

#include <log_event.h>

Inheritance diagram for Gtid_log_event:
[legend]

Public Types

using Tsid = mysql::gtid::Tsid
 
- Public Types inherited from mysql::binlog::event::Gtid_event
using Field_missing_functor = mysql::serialization::Field_missing_functor
 
using Field_encode_predicate = mysql::serialization::Field_encode_predicate
 
using Uuid = mysql::gtid::Uuid
 
using Tag_plain = mysql::gtid::Tag_plain
 
using Write_archive_type = mysql::serialization::Write_archive_binary
 
using Read_archive_type = mysql::serialization::Read_archive_binary
 
using Encoder_type = mysql::serialization::Serializer_default< Write_archive_type >
 
using Decoder_type = mysql::serialization::Serializer_default< Read_archive_type >
 
- Public Types inherited from mysql::binlog::event::Binary_log_event
enum  enum_post_header_length {
  QUERY_HEADER_MINIMAL_LEN = (4 + 4 + 1 + 2) , QUERY_HEADER_LEN = (QUERY_HEADER_MINIMAL_LEN + 2) , STOP_HEADER_LEN = 0 , START_V3_HEADER_LEN = (2 + ST_SERVER_VER_LEN + 4) ,
  ROTATE_HEADER_LEN = 8 , INTVAR_HEADER_LEN = 0 , APPEND_BLOCK_HEADER_LEN = 4 , DELETE_FILE_HEADER_LEN = 4 ,
  RAND_HEADER_LEN = 0 , USER_VAR_HEADER_LEN = 0 , FORMAT_DESCRIPTION_HEADER_LEN = (START_V3_HEADER_LEN + 1 + LOG_EVENT_TYPES) , XID_HEADER_LEN = 0 ,
  BEGIN_LOAD_QUERY_HEADER_LEN = APPEND_BLOCK_HEADER_LEN , ROWS_HEADER_LEN_V1 = 8 , TABLE_MAP_HEADER_LEN = 8 , EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN = (4 + 4 + 4 + 1) ,
  EXECUTE_LOAD_QUERY_HEADER_LEN , INCIDENT_HEADER_LEN = 2 , HEARTBEAT_HEADER_LEN = 0 , IGNORABLE_HEADER_LEN = 0 ,
  ROWS_HEADER_LEN_V2 = 10 , TRANSACTION_CONTEXT_HEADER_LEN = 18 , VIEW_CHANGE_HEADER_LEN = 52 , XA_PREPARE_HEADER_LEN = 0 ,
  TRANSACTION_PAYLOAD_HEADER_LEN = 0
}
 The lengths for the fixed data part of each event. More...
 
- Public Types inherited from Log_event
enum  enum_skip_reason { EVENT_SKIP_NOT , EVENT_SKIP_IGNORE , EVENT_SKIP_COUNT }
 Enumeration of what kinds of skipping (and non-skipping) that can occur when the slave executes an event. More...
 

Public Member Functions

 Gtid_log_event (Gtid_log_event &&) noexcept=delete
 
Gtid_log_eventoperator= (Gtid_log_event &&) noexcept=delete
 
 Gtid_log_event (const Gtid_log_event &)=delete
 
Gtid_log_eventoperator= (const Gtid_log_event &)=delete
 
 Gtid_log_event (THD *thd_arg, bool using_trans, int64 last_committed_arg, int64 sequence_number_arg, bool may_have_sbr_stmts_arg, ulonglong original_commit_timestamp_arg, ulonglong immediate_commit_timestamp_arg, uint32_t original_server_version_arg, uint32_t immediate_server_version_arg)
 Create a new event using the GTID owned by the given thread. More...
 
 Gtid_log_event (uint32 server_id_arg, bool using_trans, int64 last_committed_arg, int64 sequence_number_arg, bool may_have_sbr_stmts_arg, ulonglong original_commit_timestamp_arg, ulonglong immediate_commit_timestamp_arg, const Gtid_specification spec_arg, uint32_t original_server_version_arg, uint32_t immediate_server_version_arg)
 Create a new event using the GTID from the given Gtid_specification without a THD object. More...
 
int pack_info (Protocol *) override
 Stores a string representation of this event in the Protocol. More...
 
 Gtid_log_event (const char *buffer, const mysql::binlog::event::Format_description_event *description_event)
 
 ~Gtid_log_event () override=default
 
void claim_memory_ownership (bool claim) override
 Allow thread to CLAIM or DISCLAIM the ownership of this object depends on the parameter value passed. More...
 
size_t get_data_size () override
 
void clear_gtid_and_spec ()
 Clears tsid and spec. More...
 
void update_parent_gtid_info ()
 Updates parent tsid and gtid info structure. More...
 
size_t get_event_length ()
 
size_t to_string (char *buf) const
 Used internally by both print() and pack_info(). More...
 
int do_apply_event (Relay_log_info const *rli) override
 Primitive to apply an event to the database. More...
 
int do_update_pos (Relay_log_info *rli) override
 Advance relay log coordinates. More...
 
enum_skip_reason do_shall_skip (Relay_log_info *rli) override
 Decide if this event shall be skipped or not and the reason for skipping it. More...
 
enum_gtid_type get_type () const
 Return the gtid type for this Gtid_log_event: this can be either ANONYMOUS_GTID, AUTOMATIC_GTID, or ASSIGNED_GTID. More...
 
const Tsidget_tsid () const
 Return the TSID for this GTID. More...
 
rpl_sidno get_sidno (bool need_lock)
 Return the SIDNO relative to the global tsid_map for this GTID. More...
 
rpl_sidno get_sidno (Tsid_map *tsid_map)
 Return the SIDNO relative to the given Tsid_map for this GTID. More...
 
rpl_gno get_gno () const override
 Return the GNO for this GTID. More...
 
void set_trx_length_by_cache_size (ulonglong cache_size, bool is_checksum_enabled=false, int event_counter=0)
 Set the transaction length information based on binlog cache size. More...
 
void set_trx_length_by_cache_size_tagged (ulonglong cache_size, bool is_checksum_enabled=false, int event_counter=0)
 Set the transaction length information based on binlog cache size. More...
 
- Public Member Functions inherited from mysql::binlog::event::Gtid_event
 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...
 
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_eventoperator= (const Binary_log_event &)=default
 
Binary_log_eventoperator= (Binary_log_event &&)=default
 
enum Log_event_type get_event_type () const
 Helper method. More...
 
const Log_event_headerheader () const
 Return a const pointer to the header of the log event. More...
 
Log_event_headerheader ()
 Return a non-const pointer to the header of the log event. More...
 
const Log_event_footerfooter () const
 Return a const pointer to the footer of the log event. More...
 
Log_event_footerfooter ()
 Return a non-const pointer to the footer of the log event. More...
 
Event_readerreader ()
 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
 
- Public Member Functions inherited from Log_event
 Log_event (mysql::binlog::event::Log_event_header *header, mysql::binlog::event::Log_event_footer *footer, enum_event_cache_type cache_type_arg, enum_event_logging_type logging_type_arg)
 This minimal constructor is for when you are not even sure that there is a valid THD. More...
 
 Log_event (THD *thd_arg, uint16 flags_arg, enum_event_cache_type cache_type_arg, enum_event_logging_type logging_type_arg, mysql::binlog::event::Log_event_header *header, mysql::binlog::event::Log_event_footer *footer)
 
int net_send (Protocol *protocol, const char *log_name, my_off_t pos)
 Only called by SHOW BINLOG EVENTS. More...
 
virtual const char * get_db ()
 
void * operator new (size_t size)
 
bool wrapper_my_b_safe_write (Basic_ostream *ostream, const uchar *buf, size_t data_length)
 Write the given buffer to the given output stream, updating the checksum if checksums are enabled. More...
 
virtual bool write (Basic_ostream *ostream)
 
time_t get_time ()
 Prints a "session_var=value" string. More...
 
virtual mysql::binlog::event::Log_event_type get_type_code () const
 
virtual bool is_sbr_logging_format () const
 Return true if the event has to be logged using SBR for DMLs. More...
 
virtual bool is_rbr_logging_format () const
 Return true if the event has to be logged using RBR for DMLs. More...
 
bool is_valid ()
 
void set_artificial_event ()
 
void set_relay_log_event ()
 
bool is_artificial_event () const
 
bool is_relay_log_event () const
 
bool is_ignorable_event () const
 
bool is_no_filter_event () const
 
bool is_using_trans_cache () const
 
bool is_using_stmt_cache () const
 
bool is_using_immediate_logging () const
 
 Log_event (mysql::binlog::event::Log_event_header *header, mysql::binlog::event::Log_event_footer *footer)
 
virtual ~Log_event ()
 
void register_temp_buf (char *buf, bool free_in_destructor=true)
 
void free_temp_buf ()
 
const char * get_type_str () const
 Returns the human readable name of this event's type. More...
 
bool is_mts_sequential_exec ()
 Is called from get_mts_execution_mode() to. More...
 
virtual uint8 get_mts_dbs (Mts_db_names *arg, Rpl_filter *rpl_filter)
 The method fills in pointers to event's database name c-strings to a supplied array. More...
 
bool contains_partition_info (bool)
 
virtual uint8 mts_number_dbs ()
 
bool is_mts_group_isolated ()
 
virtual bool starts_group () const
 Events of a certain type can start or end a group of events treated transactionally wrt binlog. More...
 
virtual bool ends_group () const
 
int apply_event (Relay_log_info *rli)
 Apply the event to the database. More...
 
int apply_gtid_event (Relay_log_info *rli)
 Apply the GTID event in curr_group_data to the database. More...
 
int update_pos (Relay_log_info *rli)
 Update the relay log position. More...
 
enum_skip_reason shall_skip (Relay_log_info *rli)
 Decide if the event shall be skipped, and the reason for skipping it. More...
 
virtual int do_apply_event_worker (Slave_worker *w)
 

Static Public Attributes

static const char * SET_STRING_PREFIX = "SET @@SESSION.GTID_NEXT= '"
 string holding the text "SET @@GLOBAL.GTID_NEXT = '" More...
 
- Static Public Attributes inherited from mysql::binlog::event::Gtid_event
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)
 

Private Member Functions

bool write_data_header (Basic_ostream *ostream) override
 Writes the post-header to the given output stream. More...
 
bool write_data_body (Basic_ostream *ostream) override
 
uint32 write_post_header_to_memory (uchar *buffer)
 Writes the post-header to the given memory buffer. More...
 
uint32 write_body_to_memory (uchar *buff)
 Writes the body to the given memory buffer. More...
 
uint32 write_tagged_event_body_to_memory (uchar *buffer)
 Writes the body to the given memory buffer. More...
 

Private Attributes

Gtid_specification spec
 Internal representation of the GTID. More...
 
Tsid tsid
 TSID for this GTID. More...
 

Static Private Attributes

static const size_t SET_STRING_PREFIX_LENGTH = 26
 Length of SET_STRING_PREFIX. More...
 
static const size_t MAX_SET_STRING_LENGTH
 The maximal length of the entire "SET ..." query. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from mysql::binlog::event::Gtid_event
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...
 
- Static Public Member Functions inherited from Log_event
static void init_show_field_list (mem_root_deque< Item * > *field_list)
 init_show_field_list() prepares the column names and types for the output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG EVENTS. More...
 
static void operator delete (void *ptr, size_t)
 
static void * operator new (size_t, void *ptr)
 
static void operator delete (void *, void *)
 
static const char * get_type_str (mysql::binlog::event::Log_event_type type)
 Returns the human readable name of the given event type. More...
 
static const char * get_type_str (uint type)
 Get the name of an event type, or "Unknown" if out of range. More...
 
- Public Attributes inherited from mysql::binlog::event::Gtid_event
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...
 
- Public Attributes inherited from Log_event
char * temp_buf
 
bool m_free_temp_buf_in_destructor
 
ulong exec_time
 
uint32 server_id
 
ulong rbr_exec_mode
 A storage to cache the global system variable's value. More...
 
enum_event_cache_type event_cache_type
 Defines the type of the cache, if any, where the event will be stored before being flushed to disk. More...
 
enum_event_logging_type event_logging_type
 Defines when information, i.e. More...
 
ha_checksum crc
 Placeholder for event checksum while writing to binlog. More...
 
ulong mts_group_idx
 Index in rli->gaq array to indicate a group that this event is purging. More...
 
mysql::binlog::event::Log_event_headercommon_header
 The Log_event_header class contains the variable present in the common header. More...
 
mysql::binlog::event::Log_event_footercommon_footer
 The Log_event_footer class contains the variable present in the common footer. More...
 
Relay_log_infoworker
 MTS: associating the event with either an assigned Worker or Coordinator. More...
 
ulonglong future_event_relay_log_pos
 A copy of the main rli value stored into event to pass to MTS worker rli. More...
 
THDthd
 
db_worker_hash_entrymts_assigned_partitions [MAX_DBS_IN_EVENT_MTS]
 Partition info associate with event to deliver to MTS event applier. More...
 
- Protected Types inherited from mysql::serialization::Serializable< Gtid_event >
using Tag = Serializable_tag
 
- Protected Types inherited from Log_event
enum  enum_event_cache_type {
  EVENT_INVALID_CACHE = 0 , EVENT_STMT_CACHE , EVENT_TRANSACTIONAL_CACHE , EVENT_NO_CACHE ,
  EVENT_CACHE_COUNT
}
 
enum  enum_event_logging_type { EVENT_INVALID_LOGGING = 0 , EVENT_NORMAL_LOGGING , EVENT_IMMEDIATE_LOGGING , EVENT_CACHE_LOGGING_COUNT }
 
- Protected Member Functions inherited from mysql::binlog::event::Gtid_event
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...
 
Serializableoperator= (const Serializable &)=default
 
Serializableoperator= (Serializable &&)=default
 
virtual ~Serializable ()=default
 Creation of Serializable objects is prohibited. More...
 
- Protected Member Functions inherited from Log_event
uint32 write_header_to_memory (uchar *buf)
 Writes the common header of this event to the given memory buffer. More...
 
bool write_header (Basic_ostream *ostream, size_t data_length)
 Writes the common-header of this event to the given output stream and updates the checksum. More...
 
bool write_footer (Basic_ostream *ostream)
 
bool need_checksum ()
 A decider of whether to trigger checksum computation or not. More...
 
enum_skip_reason continue_group (Relay_log_info *rli)
 Helper function to ignore an event w.r.t. More...
 
- Protected Attributes inherited from mysql::binlog::event::Gtid_event
gtid_info gtid_info_struct
 
mysql::gtid::Tsid tsid_parent_struct
 
- Static Protected Attributes inherited from mysql::binlog::event::Gtid_event
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...
 

Detailed Description

This is a subclass if Gtid_event and Log_event.

It contains per-transaction fields, including the GTID and logical timestamps used by MTS.

Member Typedef Documentation

◆ Tsid

Constructor & Destructor Documentation

◆ Gtid_log_event() [1/5]

Gtid_log_event::Gtid_log_event ( Gtid_log_event &&  )
deletenoexcept

◆ Gtid_log_event() [2/5]

Gtid_log_event::Gtid_log_event ( const Gtid_log_event )
delete

◆ Gtid_log_event() [3/5]

Gtid_log_event::Gtid_log_event ( THD thd_arg,
bool  using_trans,
int64  last_committed_arg,
int64  sequence_number_arg,
bool  may_have_sbr_stmts_arg,
ulonglong  original_commit_timestamp_arg,
ulonglong  immediate_commit_timestamp_arg,
uint32_t  original_server_version_arg,
uint32_t  immediate_server_version_arg 
)

Create a new event using the GTID owned by the given thread.

◆ Gtid_log_event() [4/5]

Gtid_log_event::Gtid_log_event ( uint32  server_id_arg,
bool  using_trans,
int64  last_committed_arg,
int64  sequence_number_arg,
bool  may_have_sbr_stmts_arg,
ulonglong  original_commit_timestamp_arg,
ulonglong  immediate_commit_timestamp_arg,
const Gtid_specification  spec_arg,
uint32_t  original_server_version_arg,
uint32_t  immediate_server_version_arg 
)

Create a new event using the GTID from the given Gtid_specification without a THD object.

◆ Gtid_log_event() [5/5]

Gtid_log_event::Gtid_log_event ( const char *  buffer,
const mysql::binlog::event::Format_description_event description_event 
)

◆ ~Gtid_log_event()

Gtid_log_event::~Gtid_log_event ( )
overridedefault

Member Function Documentation

◆ claim_memory_ownership()

void Gtid_log_event::claim_memory_ownership ( bool  claim)
overridevirtual

Allow thread to CLAIM or DISCLAIM the ownership of this object depends on the parameter value passed.

Parameters
claimTrue - claim ownership of the memory False - disclaim ownership of the memory

Reimplemented from Log_event.

◆ clear_gtid_and_spec()

void Gtid_log_event::clear_gtid_and_spec ( )

Clears tsid and spec.

◆ do_apply_event()

int Gtid_log_event::do_apply_event ( Relay_log_info const *  rli)
overridevirtual

Primitive to apply an event to the database.

This is where the change to the database is made.

Note
The primitive is protected instead of private, since there is a hierarchy of actions to be performed in some cases.
See also
Format_description_log_event::do_apply_event()
Parameters
rliPointer to relay log info structure
Return values
0Event applied successfully
errnoError code if event application failed

Set the original/immediate server version. It will be set to UNKNOWN_SERVER_VERSION if the event does not contain such information.

Reimplemented from Log_event.

◆ do_shall_skip()

Log_event::enum_skip_reason Gtid_log_event::do_shall_skip ( Relay_log_info rli)
overridevirtual

Decide if this event shall be skipped or not and the reason for skipping it.

The default implementation decide that the event shall be skipped if either:

  • the server id of the event is the same as the server id of the server and rli->replicate_same_server_id is true, or
  • if rli->slave_skip_counter is greater than zero.
See also
do_apply_event
do_update_pos
Return values
Log_event::EVENT_SKIP_NOTThe event shall not be skipped and should be applied.
Log_event::EVENT_SKIP_IGNOREThe event shall be skipped by just ignoring it, i.e., the slave skip counter shall not be changed. This happends if, for example, the originating server id of the event is the same as the server id of the slave.
Log_event::EVENT_SKIP_COUNTThe event shall be skipped because the slave skip counter was non-zero. The caller shall decrease the counter by one.

Reimplemented from Log_event.

◆ do_update_pos()

int Gtid_log_event::do_update_pos ( Relay_log_info rli)
overridevirtual

Advance relay log coordinates.

This function is called to advance the relay log coordinates to just after the event. It is essential that both the relay log coordinate and the group log position is updated correctly, since this function is used also for skipping events.

Normally, each implementation of do_update_pos() shall:

  • Update the event position to refer to the position just after the event.
  • Update the group log position to refer to the position just after the event if the event is last in a group
Parameters
rliPointer to relay log info structure
Return values
0Coordinates changed successfully
errnoError code if advancing failed (usually just 1). Observe that handler errors are returned by the do_apply_event() function, and not by this one.

Reimplemented from Log_event.

◆ get_data_size()

size_t Gtid_log_event::get_data_size ( )
inlineoverridevirtual

Reimplemented from Log_event.

◆ get_event_length()

size_t Gtid_log_event::get_event_length ( )
inline

◆ get_gno()

rpl_gno Gtid_log_event::get_gno ( ) const
inlineoverridevirtual

Return the GNO for this GTID.

Reimplemented from mysql::binlog::event::Gtid_event.

◆ get_sidno() [1/2]

rpl_sidno Gtid_log_event::get_sidno ( bool  need_lock)

Return the SIDNO relative to the global tsid_map for this GTID.

This requires a lookup and possibly even update of global_tsid_map, hence global_tsid_lock must be held. If global_tsid_lock is not held, the caller must pass need_lock=true. If there is an error (e.g. out of memory) while updating global_tsid_map, this function returns a negative number.

Parameters
need_lockIf true, the read lock on global_tsid_lock is acquired and released inside this function; if false, the read lock or write lock must be held prior to calling this function.
Return values
SIDNOif successful
negativeif adding TSID to global_tsid_map causes an error.

◆ get_sidno() [2/2]

rpl_sidno Gtid_log_event::get_sidno ( Tsid_map tsid_map)
inline

Return the SIDNO relative to the given Tsid_map for this GTID.

This assumes that the Tsid_map is local to the thread, and thus does not use locks.

Parameters
tsid_mapThe tsid_map to use.
Return values
SIDNOif successful.
negativeif adding TSID to tsid_map causes an error.

◆ get_tsid()

const Tsid & Gtid_log_event::get_tsid ( ) const
inline

Return the TSID for this GTID.

The TSID is shared with the Log_event so it should not be modified.

◆ get_type()

enum_gtid_type Gtid_log_event::get_type ( ) const
inline

Return the gtid type for this Gtid_log_event: this can be either ANONYMOUS_GTID, AUTOMATIC_GTID, or ASSIGNED_GTID.

◆ operator=() [1/2]

Gtid_log_event & Gtid_log_event::operator= ( const Gtid_log_event )
delete

◆ operator=() [2/2]

Gtid_log_event & Gtid_log_event::operator= ( Gtid_log_event &&  )
deletenoexcept

◆ pack_info()

int Gtid_log_event::pack_info ( Protocol protocol)
overridevirtual

Stores a string representation of this event in the Protocol.

This is used by SHOW BINLOG EVENTS.

Return values
0success
nonzeroerror

Reimplemented from Log_event.

◆ set_trx_length_by_cache_size()

void Gtid_log_event::set_trx_length_by_cache_size ( ulonglong  cache_size,
bool  is_checksum_enabled = false,
int  event_counter = 0 
)

Set the transaction length information based on binlog cache size.

Note that is_checksum_enabled and event_counter are optional parameters. When not specified, the function will assume that no checksum will be used and the informed cache_size is the final transaction size without considering the GTID event size.

The high level formula that will be used by the function is:

trx_length = cache_size + cache_checksum_active * cache_events * CRC32_payload + gtid_length + cache_checksum_active * CRC32_payload; // For the GTID.

Parameters
cache_sizeThe size of the binlog cache in bytes.
is_checksum_enabledIf checksum will be added to events on flush.
event_counterThe amount of events in the cache.

◆ set_trx_length_by_cache_size_tagged()

void Gtid_log_event::set_trx_length_by_cache_size_tagged ( ulonglong  cache_size,
bool  is_checksum_enabled = false,
int  event_counter = 0 
)

Set the transaction length information based on binlog cache size.

Note that is_checksum_enabled and event_counter are optional parameters. When not specified, the function will assume that no checksum will be used and the informed cache_size is the final transaction size without considering the GTID event size.

The high level formula that will be used by the function is:

trx_length = cache_size + cache_checksum_active * cache_events * CRC32_payload + gtid_length + cache_checksum_active * CRC32_payload; // For the GTID.

Parameters
cache_sizeThe size of the binlog cache in bytes.
is_checksum_enabledIf checksum will be added to events on flush.
event_counterThe amount of events in the cache. @detail tagged version of event

◆ to_string()

size_t Gtid_log_event::to_string ( char *  buf) const

Used internally by both print() and pack_info().

◆ update_parent_gtid_info()

void Gtid_log_event::update_parent_gtid_info ( )

Updates parent tsid and gtid info structure.

◆ write_body_to_memory()

uint32 Gtid_log_event::write_body_to_memory ( uchar buff)
private

Writes the body to the given memory buffer.

This is an auxiliary function used by write_to_memory.

Parameters
[in,out]buffBuffer to which the data will be written.
Returns
The number of bytes written, i.e., If the transaction did not originated on this server Gtid_event::IMMEDIATE_COMMIT_TIMESTAMP_LENGTH. else FULL_COMMIT_TIMESTAMP_LENGTH.

◆ write_data_body()

bool Gtid_log_event::write_data_body ( Basic_ostream ostream)
overrideprivatevirtual

Reimplemented from Log_event.

◆ write_data_header()

bool Gtid_log_event::write_data_header ( Basic_ostream ostream)
overrideprivatevirtual

Writes the post-header to the given output stream.

This is an auxiliary function typically used by the write() member function.

Parameters
ostreamThe output stream to write to.
Return values
trueError.
falseSuccess.

Reimplemented from Log_event.

◆ write_post_header_to_memory()

uint32 Gtid_log_event::write_post_header_to_memory ( uchar buffer)
private

Writes the post-header to the given memory buffer.

This is an auxiliary function used by write_to_memory.

Parameters
[in,out]bufferBuffer to which the post-header will be written.
Returns
The number of bytes written, i.e., always Gtid_log_event::POST_HEADER_LENGTH.

◆ write_tagged_event_body_to_memory()

uint32 Gtid_log_event::write_tagged_event_body_to_memory ( uchar buffer)
private

Writes the body to the given memory buffer.

This is an auxiliary function used by write_to_memory.

Parameters
[in,out]buffBuffer to which the data will be written.
Returns
The number of bytes written, i.e., If the transaction did not originated on this server Gtid_event::IMMEDIATE_COMMIT_TIMESTAMP_LENGTH. else FULL_COMMIT_TIMESTAMP_LENGTH.

Version for tagged Gtid log event

Member Data Documentation

◆ MAX_SET_STRING_LENGTH

const size_t Gtid_log_event::MAX_SET_STRING_LENGTH
staticprivate
Initial value:
static const size_t SET_STRING_PREFIX_LENGTH
Length of SET_STRING_PREFIX.
Definition: log_event.h:4115
constexpr auto tsid_max_length
Maximum TSID text length (without null character)
Definition: tsid.h:41
const int MAX_GNO_TEXT_LENGTH
The length of MAX_GNO when printed in decimal.
Definition: rpl_gtid.h:286

The maximal length of the entire "SET ..." query.

◆ SET_STRING_PREFIX

const char * Gtid_log_event::SET_STRING_PREFIX = "SET @@SESSION.GTID_NEXT= '"
static

string holding the text "SET @@GLOBAL.GTID_NEXT = '"

◆ SET_STRING_PREFIX_LENGTH

const size_t Gtid_log_event::SET_STRING_PREFIX_LENGTH = 26
staticprivate

Length of SET_STRING_PREFIX.

◆ spec

Gtid_specification Gtid_log_event::spec
private

Internal representation of the GTID.

The SIDNO will be uninitialized (value -1) until the first call to get_sidno(bool).

◆ tsid

Tsid Gtid_log_event::tsid
private

TSID for this GTID.


The documentation for this class was generated from the following files: