MySQL  8.0.0
Source Code Documentation
Transaction_boundary_parser Class Reference

This is the base class for verifying transaction boundaries in a replication event stream. More...

#include <rpl_trx_boundary_parser.h>

Public Member Functions

 Transaction_boundary_parser ()
 Constructor. More...
 
void reset ()
 Reset the transaction boundary parser state. More...
 
bool is_inside_transaction ()
 State if the transaction boundary parser is inside a transaction. More...
 
bool is_not_inside_transaction ()
 State if the transaction boundary parser is not inside a transaction. More...
 
bool is_error ()
 State if the transaction boundary parser was fed with a sequence of events that the parser wasn't able to parse correctly. More...
 
bool feed_event (const char *buf, size_t length, const Format_description_log_event *fd_event, bool throw_warnings)
 Feed the transaction boundary parser with a Log_event of any type, serialized into a char* buffer. More...
 

Private Types

enum  enum_event_boundary_type {
  EVENT_BOUNDARY_TYPE_ERROR = -1, EVENT_BOUNDARY_TYPE_GTID = 0, EVENT_BOUNDARY_TYPE_BEGIN_TRX = 1, EVENT_BOUNDARY_TYPE_END_TRX = 2,
  EVENT_BOUNDARY_TYPE_END_XA_TRX = 3, EVENT_BOUNDARY_TYPE_PRE_STATEMENT = 4, EVENT_BOUNDARY_TYPE_STATEMENT = 5, EVENT_BOUNDARY_TYPE_IGNORE = 6
}
 
enum  enum_event_parser_state {
  EVENT_PARSER_NONE, EVENT_PARSER_GTID, EVENT_PARSER_DDL, EVENT_PARSER_DML,
  EVENT_PARSER_ERROR
}
 

Private Member Functions

bool update_state (enum_event_boundary_type event_boundary_type, bool throw_warnings)
 Set the boundary parser state based on the event parser logic. More...
 

Static Private Member Functions

static enum_event_boundary_type get_event_boundary_type (const char *buf, size_t length, const Format_description_log_event *description_event, bool throw_warnings)
 Parses an event based on the event parser logic. More...
 

Private Attributes

enum_event_parser_state current_parser_state
 Current internal state of the event parser. More...
 

Detailed Description

This is the base class for verifying transaction boundaries in a replication event stream.

Member Enumeration Documentation

Enumerator
EVENT_BOUNDARY_TYPE_ERROR 
EVENT_BOUNDARY_TYPE_GTID 
EVENT_BOUNDARY_TYPE_BEGIN_TRX 
EVENT_BOUNDARY_TYPE_END_TRX 
EVENT_BOUNDARY_TYPE_END_XA_TRX 
EVENT_BOUNDARY_TYPE_PRE_STATEMENT 
EVENT_BOUNDARY_TYPE_STATEMENT 
EVENT_BOUNDARY_TYPE_IGNORE 
Enumerator
EVENT_PARSER_NONE 
EVENT_PARSER_GTID 
EVENT_PARSER_DDL 
EVENT_PARSER_DML 
EVENT_PARSER_ERROR 

Constructor & Destructor Documentation

Transaction_boundary_parser::Transaction_boundary_parser ( )
inline

Constructor.

Member Function Documentation

bool Transaction_boundary_parser::feed_event ( const char *  buf,
size_t  length,
const Format_description_log_event fd_event,
bool  throw_warnings 
)

Feed the transaction boundary parser with a Log_event of any type, serialized into a char* buffer.

Parameters
bufPointer to the event buffer.
lengthThe size of the event buffer.
fd_eventThe description event of the master which logged the event.
throw_warningsIf the function should throw warning messages while updating the boundary parser state. While initializing the Relay_log_info the relay log is scanned backwards and this could generate false errors. So, in this case, we don't want to throw warnings.
Returns
false if the transaction boundary parser accepted the event. true if the transaction boundary parser didn't accepted the event.
Parameters
bufPointer to the event buffer.
lengthThe size of the event buffer.
fd_eventThe description event of the master which logged the event.
throw_warningsIf the function should throw warning messages while updating the boundary parser state. While initializing the Relay_log_info the relay log is scanned backwards and this could generate false warnings. So, in this case, we don't want to throw warnings.
Returns
false if the transaction boundary parser accepted the event. true if the transaction boundary parser didn't accepted the event.
Transaction_boundary_parser::enum_event_boundary_type Transaction_boundary_parser::get_event_boundary_type ( const char *  buf,
size_t  length,
const Format_description_log_event fd_event,
bool  throw_warnings 
)
staticprivate

Parses an event based on the event parser logic.

Get the boundary type for a given Log_event of any type, serialized into a char* buffer, based on event parser logic.

Parameters
bufPointer to the event buffer.
lengthThe size of the event buffer.
fd_eventThe description event of the master which logged the event.
throw_warningsIf the function should throw warnings getting the event boundary type. Please see comments on this at feed_event().
Returns
the transaction boundary type of the event.
bool Transaction_boundary_parser::is_error ( )
inline

State if the transaction boundary parser was fed with a sequence of events that the parser wasn't able to parse correctly.

Returns
false if the boundary parser is not in the error state. true if the boundary parser is in the error state.
bool Transaction_boundary_parser::is_inside_transaction ( )
inline

State if the transaction boundary parser is inside a transaction.

This "inside a transaction" means that the parser was fed with at least one event of a transaction, but the transaction wasn't completely fed yet. This also means that the last event fed depends on following event(s) to be correctly applied.

Returns
false if the boundary parser is not inside a transaction. true if the boundary parser is inside a transaction.
bool Transaction_boundary_parser::is_not_inside_transaction ( )
inline

State if the transaction boundary parser is not inside a transaction.

This "not inside a transaction" means that the parser was fed with an event that doesn't depend on following events.

Returns
false if the boundary parser is inside a transaction. true if the boundary parser is not inside a transaction.
void Transaction_boundary_parser::reset ( void  )

Reset the transaction boundary parser state.

Reset the transaction boundary parser.

This method initialize the boundary parser state.

bool Transaction_boundary_parser::update_state ( enum_event_boundary_type  event_boundary_type,
bool  throw_warnings 
)
private

Set the boundary parser state based on the event parser logic.

Update the boundary parser state based on a given boundary type.

Parameters
event_boundary_typeThe event boundary type of the event used to fed the boundary parser.
throw_warningsIf the function should throw warnings while updating the boundary parser state. Please see comments on this at feed_event().
Returns
false State updated successfully. true There was an error updating the state.

Member Data Documentation

enum_event_parser_state Transaction_boundary_parser::current_parser_state
private

Current internal state of the event parser.


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