MySQL 8.3.0
Source Code Documentation
Certification_handler Class Reference

#include <certification_handler.h>

Inheritance diagram for Certification_handler:
[legend]

Classes

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

Public Member Functions

 Certification_handler ()
 
 ~Certification_handler () override
 
int handle_event (Pipeline_event *ev, Continuation *cont) override
 Handling of an event as defined in the handler implementation. More...
 
int handle_action (Pipeline_action *action) override
 Handling of an action as defined in the handler implementation. More...
 
int initialize () override
 Initialization as defined in the handler implementation. More...
 
int terminate () override
 Terminate the execution as defined in the handler implementation. More...
 
bool is_unique () override
 This method identifies the handler as being unique. More...
 
int get_role () override
 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 ()=default
 
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_binary_log_event (Pipeline_event *pevent, Continuation *cont)
 This method handles binary log events by storing them so they can be used on next handler. More...
 
int handle_applier_event (Pipeline_event *pevent, Continuation *cont)
 This method handles applier context events by storing them so they can be used on next handler. More...
 
int handle_applier_view_change_packet (Pipeline_event *pevent, Continuation *cont)
 This method handles applier view change packet. More...
 
int handle_recovery_metadata (Pipeline_event *pevent, Continuation *cont)
 This method saves the recovery metadata. More...
 
int handle_view_change_packet_without_vcle (Pipeline_event *pevent, Continuation *cont)
 If VC is delayed this method pushes the metadata for later processing else it processes the VC Packet. 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 inject_transactional_events (Pipeline_event *pevent, Gtid gtid, binlog::BgcTicket::ValueType bgc_ticket, 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, Continuation *cont)
 Try to log a view change event waiting for local certified transactions to finish. More...
 
binlog::BgcTicket::ValueType generate_view_change_bgc_ticket ()
 Generate a commit order ticket for the View_change transaction. More...
 
binlog::BgcTicket::ValueType increment_bgc_ticket ()
 Increment a commit order ticket for the View_change transaction. More...
 

Private Attributes

Certifiercert_module
 
THDapplier_module_thd
 
rpl_sidno group_sidno
 
Data_packettransaction_context_packet
 
Pipeline_eventtransaction_context_pevent
 
std::list< std::unique_ptr< View_change_stored_info > > pending_view_change_events_waiting_for_consistent_transactions
 All the VC events pending application due to consistent transactions. 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 ( )
override

Member Function Documentation

◆ extract_certification_info()

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

◆ generate_view_change_bgc_ticket()

binlog::BgcTicket::ValueType Certification_handler::generate_view_change_bgc_ticket ( )
private

Generate a commit order ticket for the View_change transaction.

More precisely it will: 1) increment the current ticket so that the all transactions ordered before view will have a ticket smaller than the one assigned to the view. 2) generate the ticket for the view. 3) increment again the current ticket so that all transactions ordered after the view will have a ticket greater that the one assigned to the view.

Returns
the ticket generated for the view

◆ get_certifier()

Certifier_interface * Certification_handler::get_certifier ( )

◆ get_role()

int Certification_handler::get_role ( )
overridevirtual

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)
overridevirtual

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_applier_event()

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

This method handles applier 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_applier_view_change_packet()

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

This method handles applier view change packet.

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

◆ handle_binary_log_event()

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

This method handles binary log 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_event()

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

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_recovery_metadata()

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

This method saves the recovery metadata.

It needs to be stored because if metadata sender crashes another member need to send the metadata. If member is the sender, this method also initiate the metadata send request.

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

◆ 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

◆ handle_view_change_packet_without_vcle()

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

If VC is delayed this method pushes the metadata for later processing else it processes the VC Packet.

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

◆ increment_bgc_ticket()

binlog::BgcTicket::ValueType Certification_handler::increment_bgc_ticket ( )
private

Increment a commit order ticket for the View_change transaction.

More precisely it will: 1) NOT generate the ticket for the view. 2) increment the current ticket so that all transactions ordered after the view will have a ticket greater that the one assigned to the view.

◆ initialize()

int Certification_handler::initialize ( )
overridevirtual

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,
Gtid  gtid,
binlog::BgcTicket::ValueType  bgc_ticket,
Continuation cont 
)
private

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

Parameters
[in]peventthe event to be injected
[in]gtidThe transaction GTID If {-1, -1}, one will be generated.
[in]bgc_ticketThe commit ticket order for this transaction on the binlog group commit. If 0, one will be generated.
[in]contthe object used to wait
Returns
the operation status
Return values
0OK
!=0Error

The original_commit_timestamp for this GTID will be different for each member that generated this View_change_event.

◆ is_unique()

bool Certification_handler::is_unique ( )
overridevirtual

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_view_change_event_in_order()

int Certification_handler::log_view_change_event_in_order ( Pipeline_event view_pevent,
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]contthe object used to wait
Returns
the operation status
Return values
0OK
!=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

◆ terminate()

int Certification_handler::terminate ( )
overridevirtual

Terminate the execution as defined in the handler implementation.

Implements Event_handler.

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

◆ pending_view_change_events_waiting_for_consistent_transactions

std::list<std::unique_ptr<View_change_stored_info> > Certification_handler::pending_view_change_events_waiting_for_consistent_transactions
private

All the VC events pending application due to consistent transactions.

◆ 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: