MySQL  8.0.19
Source Code Documentation
Certification_handler Class Reference

#include <certification_handler.h>

Inheritance diagram for Certification_handler:
Event_handler

Classes

struct  View_change_stored_info
 View change information information stored for delay. More...
 

Public Member Functions

 Certification_handler ()
 
virtual ~Certification_handler ()
 
int handle_event (Pipeline_event *ev, Continuation *cont)
 Handling of an event as defined in the handler implementation. More...
 
int handle_action (Pipeline_action *action)
 Handling of an action as defined in the handler implementation. More...
 
int initialize ()
 Initialization as defined in the handler implementation. More...
 
int terminate ()
 Terminate the execution as defined in the handler implementation. More...
 
bool is_unique ()
 This method identifies the handler as being unique. More...
 
int get_role ()
 This method returns the handler role. More...
 
Certifier_interfaceget_certifier ()
 
int set_certification_info (std::map< std::string, std::string > *cert_info)
 
- Public Member Functions inherited from Event_handler
 Event_handler ()
 
virtual ~Event_handler ()
 
void plug_next_handler (Event_handler *next_handler)
 Plug an handler to be the next in line for execution. More...
 
void append (Event_handler *last_handler)
 Append an handler to be the last in line for execution. More...
 
int terminate_pipeline ()
 Shutdown and delete all handlers in the pipeline. More...
 

Private Member Functions

int set_transaction_context (Pipeline_event *pevent)
 Set transaction context for next event handler. More...
 
int get_transaction_context (Pipeline_event *pevent, Transaction_context_log_event **tcle)
 Get transaction context set on previous event handler. More...
 
void reset_transaction_context ()
 Reset transaction context. More...
 
int handle_transaction_context (Pipeline_event *pevent, Continuation *cont)
 This method handles transaction context events by storing them so they can be used on next handler. More...
 
int handle_transaction_id (Pipeline_event *pevent, Continuation *cont)
 This methods handles transaction identifier events, it does two tasks: More...
 
int extract_certification_info (Pipeline_event *pevent, Continuation *cont)
 
int wait_for_local_transaction_execution (std::string &local_gtid_certified_string)
 This methods guarantees that the view change event is logged after local transactions are executed. More...
 
int inject_transactional_events (Pipeline_event *pevent, rpl_gno *event_gno, Continuation *cont)
 Create a transactional block for the received log event GTID BEGIN EVENT COMMIT. More...
 
int log_view_change_event_in_order (Pipeline_event *view_pevent, std::string &local_gtid_string, rpl_gno *event_gno, Continuation *cont)
 Try to log a view change event waiting for local certified transactions to finish. More...
 
int store_view_event_for_delayed_logging (Pipeline_event *pevent, std::string &local_gtid_certified_string, rpl_gno event_gno, Continuation *cont)
 Store the event for future logging as a timeout occurred. More...
 
int log_delayed_view_change_events (Continuation *cont)
 Logs all the delayed View Change log events stored. More...
 

Private Attributes

Certifiercert_module
 
THDapplier_module_thd
 
rpl_sidno group_sidno
 
Data_packettransaction_context_packet
 
Pipeline_eventtransaction_context_pevent
 
bool m_view_change_event_on_wait
 Are view change on wait for application. More...
 
std::list< View_change_stored_info * > pending_view_change_events
 All the VC events pending application due to timeout. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Event_handler
static void append_handler (Event_handler **pipeline, Event_handler *event_handler)
 Append an handler to a given pipeline. More...
 
static void get_handler_by_role (Event_handler *pipeline, int role, Event_handler **event_handler)
 Returns an handler that plays the given role. More...
 
- Protected Member Functions inherited from Event_handler
int next (Pipeline_event *event, Continuation *continuation)
 Pass the event to the next handler in line. More...
 
int next (Pipeline_action *action)
 Pass the action to the next handler in line. More...
 

Constructor & Destructor Documentation

◆ Certification_handler()

Certification_handler::Certification_handler ( )

◆ ~Certification_handler()

Certification_handler::~Certification_handler ( )
virtual

Member Function Documentation

◆ extract_certification_info()

int Certification_handler::extract_certification_info ( Pipeline_event pevent,
Continuation cont 
)
private

◆ get_certifier()

Certifier_interface * Certification_handler::get_certifier ( )

◆ get_role()

int Certification_handler::get_role ( )
virtual

This method returns the handler role.

Handlers can have different roles according to the tasks they represent. Is based on this role that certain components can extract and interact with pipeline handlers. This means that if a role is given to a singleton handler, no one else can have that role.

Returns
the handler role

Implements Event_handler.

◆ get_transaction_context()

int Certification_handler::get_transaction_context ( Pipeline_event pevent,
Transaction_context_log_event **  tcle 
)
private

Get transaction context set on previous event handler.

Parameters
[in]peventPipeline event that wraps Gtid_log_event.
[out]tcleTransaction_context_log_event.
Returns
Operation status
Return values
0OK
!=0Error

◆ handle_action()

int Certification_handler::handle_action ( Pipeline_action action)
virtual

Handling of an action as defined in the handler implementation.

As the handler can be included in a pipeline, somewhere in the method, the handler.next(action) method shall be invoked to allow the passing of the action to the next handler.

Note
Actions should not be treated asynchronously and as so, Continuations are not used here. Errors are returned directly or passed by in the action if it includes support for such
Parameters
[in]actionthe pipeline event to be handled

Implements Event_handler.

◆ handle_event()

int Certification_handler::handle_event ( Pipeline_event event,
Continuation continuation 
)
virtual

Handling of an event as defined in the handler implementation.

As the handler can be included in a pipeline, somewhere in the method, the handler.next(event,continuation) method shall be invoked to allow the passing of the event to the next handler.

Also, if an error occurs, the continuation object shall be used to propagate such error. This class can also be used to know/report when the transaction to whom the event belongs was discarded.

Parameters
[in]eventthe pipeline event to be handled
[in,out]continuationtermination notification object.

Implements Event_handler.

◆ handle_transaction_context()

int Certification_handler::handle_transaction_context ( Pipeline_event pevent,
Continuation cont 
)
private

This method handles transaction context events by storing them so they can be used on next handler.

Parameters
[in]peventthe event to be injected
[in]contthe object used to wait
Returns
the operation status
Return values
0OK
!=0Error

◆ handle_transaction_id()

int Certification_handler::handle_transaction_id ( Pipeline_event pevent,
Continuation cont 
)
private

This methods handles transaction identifier events, it does two tasks:

  1. Using transaction context previously processed and stored, validate that this transaction does not conflict with any other;
  2. If the transaction does not conflict and it is allowed to commit, it does inform the server of that decision and does update the transaction identifier if needed.
Parameters
[in]peventthe event to be injected
[in]contthe object used to wait
Returns
the operation status
Return values
0OK
!=0Error

◆ initialize()

int Certification_handler::initialize ( )
virtual

Initialization as defined in the handler implementation.

Note
It's up to the developer to decide its own initialization strategy, but the suggested approach is to initialize basic structures here and then depend on Action packets to configure and start existing handler routines.

Implements Event_handler.

◆ inject_transactional_events()

int Certification_handler::inject_transactional_events ( Pipeline_event pevent,
rpl_gno event_gno,
Continuation cont 
)
private

Create a transactional block for the received log event GTID BEGIN EVENT COMMIT.

Parameters
[in]peventthe event to be injected
[in,out]event_gnoThe transaction GTID gno If -1, one will be generated.
[in]contthe object used to wait
Returns
the operation status
Return values
0OK
!=0Error

The original_commit_timestamp of this Gtid_log_event will be zero because the transaction corresponds to a View_change_event, which is generated and committed locally by all members. Consequently, there is no 'original master'. So, instead of each member generating a GTID with its own unique original_commit_timestamp (and violating the property that the original_commit_timestamp is the same for a given GTID), this timestamp will not be defined.

◆ is_unique()

bool Certification_handler::is_unique ( )
virtual

This method identifies the handler as being unique.

An handler that is defined as unique is an handler that cannot be used more than once in a pipeline. Such tasks as certification and event application can only be done once. Unique handlers are also the only that, by being one of a kind, can be extracted during the pipeline life allowing dynamic changes to them.

Returns
if the handler is the a unique handler
Return values
trueis a unique handler
falseis a repeatable handler

Implements Event_handler.

◆ log_delayed_view_change_events()

int Certification_handler::log_delayed_view_change_events ( Continuation cont)
private

Logs all the delayed View Change log events stored.

Parameters
[in]contthe object used to mark error or success
Returns
the operation status
Return values
0OK
LOCAL_WAIT_TIMEOUT_ERRORTimeout error on wait for local transactions
!=0Error

◆ log_view_change_event_in_order()

int Certification_handler::log_view_change_event_in_order ( Pipeline_event view_pevent,
std::string &  local_gtid_string,
rpl_gno event_gno,
Continuation cont 
)
private

Try to log a view change event waiting for local certified transactions to finish.

Parameters
[in]view_peventthe event to be injected
[in,out]local_gtid_stringThe local certified transaction set to wait If empty, one will be assigned even on timeout
[in,out]event_gnoThe transaction GTID gno If -1, one will be generated.
[in]contthe object used to wait
Returns
the operation status
Return values
0OK
LOCAL_WAIT_TIMEOUT_ERRORTimeout error on wait for local transactions
!=0Error

Create a transactional block for the View change log event GTID BEGIN VCLE COMMIT

◆ reset_transaction_context()

void Certification_handler::reset_transaction_context ( )
private

Reset transaction context.

◆ set_certification_info()

int Certification_handler::set_certification_info ( std::map< std::string, std::string > *  cert_info)

◆ set_transaction_context()

int Certification_handler::set_transaction_context ( Pipeline_event pevent)
private

Set transaction context for next event handler.

Parameters
[in]peventPipeline event that wraps Transaction_context_log_event.
Returns
Operation status
Return values
0OK
!=0Error

◆ store_view_event_for_delayed_logging()

int Certification_handler::store_view_event_for_delayed_logging ( Pipeline_event pevent,
std::string &  local_gtid_certified_string,
rpl_gno  event_gno,
Continuation cont 
)
private

Store the event for future logging as a timeout occurred.

This method does 2 things:

  1. If not stored in the past, it stores the Pipeline event to be logged in the future
  2. It queues again in the applier a fake View change log event to ensure the logging method will be invoked eventually
Parameters
[in]peventThe event to be stored
[in]local_gtid_certified_stringThe local certified transaction set to wait
[in]event_gnoThe transaction GTID gno
[in]contUsed to discard or not the transaction
Returns
the operation status
Return values
0OK
!=0Error

◆ terminate()

int Certification_handler::terminate ( )
virtual

Terminate the execution as defined in the handler implementation.

Implements Event_handler.

◆ wait_for_local_transaction_execution()

int Certification_handler::wait_for_local_transaction_execution ( std::string &  local_gtid_certified_string)
private

This methods guarantees that the view change event is logged after local transactions are executed.

Parameters
local_gtid_certified_stringThe set to wait. If not defined, it extracts the current certified set
Return values
0OK
LOCAL_WAIT_TIMEOUT_ERRORTimeout error on wait
!=0Wait or interface error

Member Data Documentation

◆ applier_module_thd

THD* Certification_handler::applier_module_thd
private

◆ cert_module

Certifier* Certification_handler::cert_module
private

◆ group_sidno

rpl_sidno Certification_handler::group_sidno
private

◆ m_view_change_event_on_wait

bool Certification_handler::m_view_change_event_on_wait
private

Are view change on wait for application.

◆ pending_view_change_events

std::list<View_change_stored_info *> Certification_handler::pending_view_change_events
private

All the VC events pending application due to timeout.

◆ transaction_context_packet

Data_packet* Certification_handler::transaction_context_packet
private

◆ transaction_context_pevent

Pipeline_event* Certification_handler::transaction_context_pevent
private

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