MySQL 9.1.0
Source Code Documentation
Log_event Class Reference

This is the abstract base class for binary log events. More...

#include <log_event.h>

Inheritance diagram for Log_event:
[legend]

Public Types

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...
 
enum  enum_mts_event_exec_mode { EVENT_EXEC_PARALLEL , EVENT_EXEC_ASYNC , EVENT_EXEC_SYNC , EVENT_EXEC_CAN_NOT }
 

Public Member Functions

 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 int pack_info (Protocol *protocol)
 Stores a string representation of this event in the Protocol. 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 bool write_data_header (Basic_ostream *)
 
virtual bool write_data_body (Basic_ostream *)
 
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 void claim_memory_ownership (bool claim)
 Allow thread to CLAIM or DISCLAIM the ownership of this object depends on the parameter value passed. More...
 
virtual ~Log_event ()
 
void register_temp_buf (char *buf, bool free_in_destructor=true)
 
void free_temp_buf ()
 
virtual size_t get_data_size ()
 
const char * get_type_str () const
 Returns the human readable name of this event's type. More...
 
bool is_mts_sequential_exec () const
 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 (Relay_log_info const *rli)
 Primitive to apply an event to the database. More...
 
virtual int do_apply_event_worker (Slave_worker *w)
 

Static Public Member Functions

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...
 
static bool is_mts_sequential_exec (mysql::binlog::event::Log_event_type type_code)
 
static enum enum_mts_event_exec_mode get_mts_execution_mode (bool mts_in_group, mysql::binlog::event::Log_event_type type_code, uint32 server_id, uint32 log_pos)
 

Public Attributes

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

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

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...
 
virtual int do_update_pos (Relay_log_info *rli)
 Advance relay log coordinates. More...
 
virtual enum_skip_reason do_shall_skip (Relay_log_info *rli)
 Decide if this event shall be skipped or not and the reason for skipping it. More...
 

Private Member Functions

enum enum_mts_event_exec_mode get_mts_execution_mode (bool mts_in_group)
 MTS Coordinator finds out a way how to execute the current event. More...
 
Slave_workerget_slave_worker (Relay_log_info *rli)
 The method maps the event to a Worker and return a pointer to it. More...
 
virtual void set_mts_isolate_group ()
 

Detailed Description

This is the abstract base class for binary log events.

Binary Format

The format of the event is described here.

Format of Atomic Primitives

  • All numbers, whether they are 16-, 24-, 32-, or 64-bit numbers, are stored in little endian, i.e., the least significant byte first, unless otherwise specified.

Member Enumeration Documentation

◆ enum_event_cache_type

Enumerator
EVENT_INVALID_CACHE 
EVENT_STMT_CACHE 
EVENT_TRANSACTIONAL_CACHE 
EVENT_NO_CACHE 
EVENT_CACHE_COUNT 

◆ enum_event_logging_type

Enumerator
EVENT_INVALID_LOGGING 
EVENT_NORMAL_LOGGING 
EVENT_IMMEDIATE_LOGGING 
EVENT_CACHE_LOGGING_COUNT 

◆ enum_mts_event_exec_mode

Enumerator
EVENT_EXEC_PARALLEL 
EVENT_EXEC_ASYNC 
EVENT_EXEC_SYNC 
EVENT_EXEC_CAN_NOT 

◆ enum_skip_reason

Enumeration of what kinds of skipping (and non-skipping) that can occur when the slave executes an event.

See also
shall_skip
do_shall_skip
Enumerator
EVENT_SKIP_NOT 

Don't skip event.

EVENT_SKIP_IGNORE 

Skip event by ignoring it.

This means that the slave skip counter will not be changed.

EVENT_SKIP_COUNT 

Skip event and decrease skip counter.

Constructor & Destructor Documentation

◆ Log_event() [1/3]

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.

For example in the server when we are shutting down or flushing logs after receiving a SIGHUP (then we must write a Rotate to the binlog but we have no THD, so we need this minimal constructor).

◆ Log_event() [2/3]

Log_event::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 
)

◆ Log_event() [3/3]

Log_event::Log_event ( mysql::binlog::event::Log_event_header header,
mysql::binlog::event::Log_event_footer footer 
)

◆ ~Log_event()

virtual Log_event::~Log_event ( )
inlinevirtual

Member Function Documentation

◆ apply_event()

int Log_event::apply_event ( Relay_log_info rli)

Apply the event to the database.

Scheduling event to execute in parallel or execute it directly.

This function represents the public interface for applying an event.

See also
do_apply_event

In MTS case the event gets associated with either Coordinator or a Worker. A special case of the association is NULL when the Worker can't be decided yet. In the single threaded sequential mode the event maps to SQL thread rli.

Note
in case of MTS failure Coordinator destroys all gathered deferred events.
Returns
0 as success, otherwise a failure.

◆ apply_gtid_event()

int Log_event::apply_gtid_event ( Relay_log_info rli)
inline

Apply the GTID event in curr_group_data to the database.

Parameters
rliPointer to coordinato's relay log info.
Return values
0success
1error

◆ claim_memory_ownership()

virtual void Log_event::claim_memory_ownership ( bool  claim)
inlinevirtual

◆ contains_partition_info()

bool Log_event::contains_partition_info ( bool  end_group_sets_max_dbs)
Returns
true if events carries partitioning data (database names).
Parameters
end_group_sets_max_dbswhen true the group terminal event can carry partition info, see a note below.
Returns
true in cases the current event carries partition data, false otherwise
Note
Some events combination may force to adjust partition info. In particular BEGIN, BEGIN_LOAD_QUERY_EVENT, COMMIT where none of the events holds partitioning data causes the sequential applying of the group through assigning OVER_MAX_DBS_IN_EVENT_MTS to mts_accessed_dbs of the group terminator (e.g COMMIT query) event.

◆ continue_group()

Log_event::enum_skip_reason Log_event::continue_group ( Relay_log_info rli)
inlineprotected

Helper function to ignore an event w.r.t.

the slave skip counter.

This function can be used inside do_shall_skip() for functions that cannot end a group. If the slave skip counter is 1 when seeing such an event, the event shall be ignored, the counter left intact, and processing continue with the next event.

A typical usage is:

return continue_group(rli);
}
enum_skip_reason continue_group(Relay_log_info *rli)
Helper function to ignore an event w.r.t.
Definition: log_event.cc:2473
enum_skip_reason
Enumeration of what kinds of skipping (and non-skipping) that can occur when the slave executes an ev...
Definition: log_event.h:547
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli)
Decide if this event shall be skipped or not and the reason for skipping it.
Definition: log_event.cc:1004
Definition: rpl_rli.h:206
Returns
Skip reason

◆ do_apply_event()

virtual int Log_event::do_apply_event ( Relay_log_info const *  rli)
inlinevirtual

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

Reimplemented in Previous_gtids_log_event, Transaction_context_log_event, Query_log_event, Format_description_log_event, Intvar_log_event, Rand_log_event, Xid_apply_log_event, User_var_log_event, Append_block_log_event, Delete_file_log_event, Execute_load_query_log_event, Table_map_log_event, Rows_log_event, Incident_log_event, Rows_query_log_event, Transaction_payload_log_event, Gtid_log_event, and View_change_log_event.

◆ do_apply_event_worker()

int Log_event::do_apply_event_worker ( Slave_worker w)
inlinevirtual

Reimplemented in Xid_apply_log_event.

◆ do_shall_skip()

Log_event::enum_skip_reason Log_event::do_shall_skip ( Relay_log_info rli)
protectedvirtual

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 in Stop_log_event, Previous_gtids_log_event, Query_log_event, Format_description_log_event, Intvar_log_event, Rand_log_event, Xid_apply_log_event, User_var_log_event, Rotate_log_event, Begin_load_query_log_event, Table_map_log_event, Rows_log_event, Transaction_payload_log_event, and Gtid_log_event.

◆ do_update_pos()

int Log_event::do_update_pos ( Relay_log_info rli)
protectedvirtual

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 in Query_log_event, Format_description_log_event, Intvar_log_event, Rand_log_event, User_var_log_event, Stop_log_event, Rotate_log_event, Table_map_log_event, Rows_log_event, Gtid_log_event, Previous_gtids_log_event, Transaction_context_log_event, and View_change_log_event.

◆ ends_group()

virtual bool Log_event::ends_group ( ) const
inlinevirtual
Returns
true if the event ends a group (transaction) false otherwise

Reimplemented in Query_log_event, Xid_apply_log_event, Incident_log_event, and Transaction_payload_log_event.

◆ free_temp_buf()

void Log_event::free_temp_buf ( )
inline

◆ get_data_size()

◆ get_db()

const char * Log_event::get_db ( )
virtual

◆ get_mts_dbs()

virtual uint8 Log_event::get_mts_dbs ( Mts_db_names arg,
Rpl_filter rpl_filter 
)
inlinevirtual

The method fills in pointers to event's database name c-strings to a supplied array.

In other than Query-log-event case the returned array contains just one item.

Parameters
[out]argpointer to a struct containing char* array pointers to be filled in and the number of filled instances.
rpl_filterpointer to a replication filter.
Returns
number of the filled instances indicating how many databases the event accesses.

Reimplemented in Query_log_event, Table_map_log_event, and Transaction_payload_log_event.

◆ get_mts_execution_mode() [1/2]

enum enum_mts_event_exec_mode Log_event::get_mts_execution_mode ( bool  mts_in_group)
inlineprivate

MTS Coordinator finds out a way how to execute the current event.

Besides the parallelizable case, some events have to be applied by Coordinator concurrently with Workers and some to require synchronization with Workers (see wait_for_workers_to_finish) before to apply them.

Parameters
mts_in_groupthe being group parsing status, true means inside the group
Return values
EVENT_EXEC_PARALLELif event is executed by a Worker
EVENT_EXEC_ASYNCif event is executed by Coordinator
EVENT_EXEC_SYNCif event is executed by Coordinator with synchronization against the Workers

◆ get_mts_execution_mode() [2/2]

static enum enum_mts_event_exec_mode Log_event::get_mts_execution_mode ( bool  mts_in_group,
mysql::binlog::event::Log_event_type  type_code,
uint32  server_id,
uint32  log_pos 
)
inlinestatic

◆ get_slave_worker()

Slave_worker * Log_event::get_slave_worker ( Relay_log_info rli)
private

The method maps the event to a Worker and return a pointer to it.

Returns
index in [0, M] range to indicate to be assigned worker; M is the max index of the worker pool.

Sending the event to the Worker is done by the caller.

Irrespective of the type of Group marking (DB partitioned or BGC) the following holds true:

  • recognize the beginning of a group to allocate the group descriptor and queue it;
  • associate an event with a Worker (which also handles possible conflicts detection and waiting for their termination);
  • finalize the group assignment when the group closing event is met.

When parallelization mode is BGC-based the partitioning info in the event is simply ignored. Thereby association with a Worker does not require Assigned Partition Hash of the partitioned method. This method is not interested in all the taxonomy of the event group property, what we care about is the boundaries of the group.

As a part of the group, an event belongs to one of the following types:

B - beginning of a group of events (BEGIN query_log_event) g - mini-group representative event containing the partition info (any Table_map, a Query_log_event) p - a mini-group internal event that *p*receding its g-parent (int_, rand_, user_ var:s) r - a mini-group internal "regular" event that follows its g-parent (Delete, Update, Write -rows) T - terminator of the group (XID, COMMIT, ROLLBACK, auto-commit query)

Only the first g-event computes the assigned Worker which once is determined remains to be for the rest of the group. That is the g-event solely carries partitioning info. For B-event the assigned Worker is NULL to indicate Coordinator has not yet decided. The same applies to p-event.

Notice, these is a special group consisting of optionally multiple p-events terminating with a g-event. Such case is caused by old master binlog and a few corner-cases of the current master version (todo: to fix).

In case of the event accesses more than OVER_MAX_DBS the method has to ensure sure previously assigned groups to all other workers are done.

Note
The function updates GAQ queue directly, updates APH hash plus relocates some temporary tables from Coordinator's list into involved entries of APH through map_db_to_worker. There's few memory allocations commented where to be freed.
Returns
a pointer to the Worker struct or NULL.

◆ get_time()

time_t Log_event::get_time ( )

Prints a "session_var=value" string.

Used by mysqlbinlog to print some SET commands just before it prints a query.

◆ get_type_code()

virtual mysql::binlog::event::Log_event_type Log_event::get_type_code ( ) const
inlinevirtual

Reimplemented in XA_prepare_log_event, and Stop_log_event.

◆ get_type_str() [1/3]

const char * Log_event::get_type_str ( ) const

Returns the human readable name of this event's type.

◆ get_type_str() [2/3]

const char * Log_event::get_type_str ( mysql::binlog::event::Log_event_type  type)
static

Returns the human readable name of the given event type.

◆ get_type_str() [3/3]

const char * Log_event::get_type_str ( uint  type)
static

Get the name of an event type, or "Unknown" if out of range.

Parameters
typeThe type as an int
Return values
nameof an event type, if it is one
Unknownif the value is out of range

◆ init_show_field_list()

void Log_event::init_show_field_list ( mem_root_deque< Item * > *  field_list)
static

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.

◆ is_artificial_event()

bool Log_event::is_artificial_event ( ) const
inline

◆ is_ignorable_event()

bool Log_event::is_ignorable_event ( ) const
inline

◆ is_mts_group_isolated()

bool Log_event::is_mts_group_isolated ( )
inline
Returns
true if the terminal event of a group is marked to execute in isolation from other Workers, false otherwise

◆ is_mts_sequential_exec() [1/2]

bool Log_event::is_mts_sequential_exec ( ) const
inline

Is called from get_mts_execution_mode() to.

Returns
true if the event needs applying with synchronization against Workers, otherwise false
Note
There are incompatile combinations such as referred further events are wrapped with BEGIN/COMMIT. Such cases should be identified by the caller and treats correspondingly.

todo: to mts-support Old master Load-data related events

◆ is_mts_sequential_exec() [2/2]

static bool Log_event::is_mts_sequential_exec ( mysql::binlog::event::Log_event_type  type_code)
inlinestatic

◆ is_no_filter_event()

bool Log_event::is_no_filter_event ( ) const
inline

◆ is_rbr_logging_format()

virtual bool Log_event::is_rbr_logging_format ( ) const
inlinevirtual

Return true if the event has to be logged using RBR for DMLs.

Reimplemented in Table_map_log_event, and Rows_log_event.

◆ is_relay_log_event()

bool Log_event::is_relay_log_event ( ) const
inline

◆ is_sbr_logging_format()

virtual bool Log_event::is_sbr_logging_format ( ) const
inlinevirtual

Return true if the event has to be logged using SBR for DMLs.

Reimplemented in Query_log_event, Intvar_log_event, Rand_log_event, User_var_log_event, Append_block_log_event, Delete_file_log_event, and Execute_load_query_log_event.

◆ is_using_immediate_logging()

bool Log_event::is_using_immediate_logging ( ) const
inline

◆ is_using_stmt_cache()

bool Log_event::is_using_stmt_cache ( ) const
inline

◆ is_using_trans_cache()

bool Log_event::is_using_trans_cache ( ) const
inline

◆ is_valid()

bool Log_event::is_valid ( void  )

◆ mts_number_dbs()

virtual uint8 Log_event::mts_number_dbs ( )
inlinevirtual

◆ need_checksum()

bool Log_event::need_checksum ( )
protected

A decider of whether to trigger checksum computation or not.

To be invoked in Log_event::write() stack. The decision is positive

S,M) if it's been marked for checksumming with checksum_alg

M) otherwise, if @global.binlog_checksum is not NONE and the event is directly written to the binlog file. The to-be-cached event decides at write_cache() time.

Otherwise the decision is negative.

Note
A side effect of the method is altering Log_event::checksum_alg it the latter was undefined at calling.
Returns
true (positive) or false (negative)

◆ net_send()

int Log_event::net_send ( Protocol protocol,
const char *  log_name,
my_off_t  pos 
)

Only called by SHOW BINLOG EVENTS.

◆ operator delete() [1/2]

static void Log_event::operator delete ( void *  ,
void *   
)
inlinestatic

◆ operator delete() [2/2]

static void Log_event::operator delete ( void *  ptr,
size_t   
)
inlinestatic

◆ operator new() [1/2]

void * Log_event::operator new ( size_t  size)

◆ operator new() [2/2]

static void * Log_event::operator new ( size_t  ,
void *  ptr 
)
inlinestatic

◆ pack_info()

◆ register_temp_buf()

void Log_event::register_temp_buf ( char *  buf,
bool  free_in_destructor = true 
)
inline

◆ set_artificial_event()

void Log_event::set_artificial_event ( )
inline

◆ set_mts_isolate_group()

virtual void Log_event::set_mts_isolate_group ( )
inlineprivatevirtual

◆ set_relay_log_event()

void Log_event::set_relay_log_event ( )
inline

◆ shall_skip()

enum_skip_reason Log_event::shall_skip ( Relay_log_info rli)
inline

Decide if the event shall be skipped, and the reason for skipping it.

See also
do_shall_skip

◆ starts_group()

virtual bool Log_event::starts_group ( ) const
inlinevirtual

Events of a certain type can start or end a group of events treated transactionally wrt binlog.

Public access is required by implementation of recovery + skip.

Returns
true if the event starts a group (transaction) false otherwise

Reimplemented in Query_log_event.

◆ update_pos()

int Log_event::update_pos ( Relay_log_info rli)
inline

Update the relay log position.

This function represents the public interface for "stepping over" the event and will update the relay log information.

See also
do_update_pos

◆ wrapper_my_b_safe_write()

bool Log_event::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.

Parameters
ostreamThe output stream to write to.
bufThe buffer to write.
data_lengthThe number of bytes to write.
Return values
falseSuccess.
trueError.

◆ write()

◆ write_data_body()

◆ write_data_header()

virtual bool Log_event::write_data_header ( Basic_ostream )
inlinevirtual

◆ write_footer()

bool Log_event::write_footer ( Basic_ostream ostream)
protected

◆ write_header()

bool Log_event::write_header ( Basic_ostream ostream,
size_t  data_length 
)
protected

Writes the common-header of this event to the given output stream and updates the checksum.

Parameters
ostreamThe event will be written to this output stream.
data_lengthThe length of the post-header section plus the length of the data section; i.e., the length of the event minus the common-header and the checksum.

◆ write_header_to_memory()

uint32 Log_event::write_header_to_memory ( uchar buf)
protected

Writes the common header of this event to the given memory buffer.

This does not update the checksum.

Note
This has the following form:

+------—+------—+------—+---------—+--------—+----—+ |timestamp|type code|server_id|event_length|end_log_pos|flags | |4 bytes |1 byte |4 bytes |4 bytes |4 bytes |2 bytes| +------—+------—+------—+---------—+--------—+----—+

Parameters
bufMemory buffer to write to. This must be at least LOG_EVENT_HEADER_LEN bytes long.
Returns
The number of bytes written, i.e., always LOG_EVENT_HEADER_LEN.

This assertion guarantees that these debug flags are not used at the same time (they would cancel each other).

Member Data Documentation

◆ common_footer

mysql::binlog::event::Log_event_footer* Log_event::common_footer

The Log_event_footer class contains the variable present in the common footer.

Currently, footer contains only the checksum_alg.

◆ common_header

mysql::binlog::event::Log_event_header* Log_event::common_header

The Log_event_header class contains the variable present in the common header.

◆ crc

ha_checksum Log_event::crc

Placeholder for event checksum while writing to binlog.

◆ event_cache_type

enum_event_cache_type Log_event::event_cache_type

Defines the type of the cache, if any, where the event will be stored before being flushed to disk.

◆ event_logging_type

enum_event_logging_type Log_event::event_logging_type

Defines when information, i.e.

event or cache, will be flushed to disk.

◆ exec_time

ulong Log_event::exec_time

◆ future_event_relay_log_pos

ulonglong Log_event::future_event_relay_log_pos

A copy of the main rli value stored into event to pass to MTS worker rli.

◆ m_free_temp_buf_in_destructor

bool Log_event::m_free_temp_buf_in_destructor

◆ mts_assigned_partitions

db_worker_hash_entry* Log_event::mts_assigned_partitions[MAX_DBS_IN_EVENT_MTS]

Partition info associate with event to deliver to MTS event applier.

◆ mts_group_idx

ulong Log_event::mts_group_idx

Index in rli->gaq array to indicate a group that this event is purging.

The index is set by Coordinator to a group terminator event is checked by Worker at the event execution. The indexed data represent the Worker progress status.

◆ rbr_exec_mode

ulong Log_event::rbr_exec_mode

A storage to cache the global system variable's value.

Handling of a separate event will be governed its member.

◆ server_id

uint32 Log_event::server_id

◆ temp_buf

char* Log_event::temp_buf

◆ thd

THD* Log_event::thd

◆ worker

Relay_log_info* Log_event::worker

MTS: associating the event with either an assigned Worker or Coordinator.

Additionally the member serves to tag deferred (IRU) events to avoid the event regular time destruction.


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