MySQL 8.3.0
Source Code Documentation
Member_actions_handler Class Reference

Handles member actions configuration and trigger. More...

#include <member_actions_handler.h>

Inheritance diagram for Member_actions_handler:
[legend]

Public Member Functions

 Member_actions_handler ()
 
virtual ~Member_actions_handler () override
 
bool init ()
 Initialize the handler. More...
 
bool deinit ()
 De-initialize the handler. More...
 
bool acquire_send_service ()
 Acquires a reference to the group_replication_message_service_send service. More...
 
bool release_send_service ()
 Releases the reference to the group_replication_message_service_send service. More...
 
bool receive (const char *tag, const unsigned char *data, size_t data_length)
 Delivery method for the group_replication_message_service_recv service. More...
 
std::pair< bool, std::string > enable_action (const std::string &name, const std::string &event)
 Enable a member action for a given event. More...
 
std::pair< bool, std::string > disable_action (const std::string &name, const std::string &event)
 Disable a member action for a given event. More...
 
bool reset_to_default_actions_configuration ()
 Reset member actions to the default configuration. More...
 
bool replace_all_actions (const std::vector< std::string > &exchanged_members_actions_serialized_configuration)
 Replace member actions configuration with the given one. More...
 
bool get_all_actions (std::string &serialized_configuration)
 Retrieve member actions configuration in the serialized format. More...
 
bool force_my_actions_configuration_on_all_members ()
 Propagate the local member actions configuration to the group, enabling the force_update flag, which will make the sent configuration to override other members configuration. More...
 
void trigger_actions (Member_actions::enum_action_event event)
 Trigger the actions configured to run on the given event. More...
 
void run (Mysql_thread_body_parameters *parameters) override
 Run the actions that were triggered. More...
 
- Public Member Functions inherited from Mysql_thread_body
virtual ~Mysql_thread_body ()
 
- Public Member Functions inherited from Configuration_propagation
virtual ~Configuration_propagation ()
 

Private Member Functions

bool propagate_serialized_configuration (const std::string &serialized_configuration) override
 Propagate the serialized configuration to the group. More...
 
int run_internal_action (const protobuf_replication_group_member_actions::Action &action)
 Run a INTERNAL action. More...
 

Private Attributes

const char * m_message_tag {"mysql_replication_group_member_actions"}
 The tag used on the messages sent by this class. More...
 
const char * m_message_service_listener_name
 The name of the message service listener. More...
 
Member_actions_handler_configurationm_configuration {nullptr}
 The table configuration abstraction layer. More...
 
Mysql_threadm_mysql_thread {nullptr}
 Single thread executor. More...
 
mysql_service_group_replication_message_service_send_tm_group_replication_message_service_send {nullptr}
 Pointer to the group_replication_message_service_send service. More...
 

Detailed Description

Handles member actions configuration and trigger.

Constructor & Destructor Documentation

◆ Member_actions_handler()

Member_actions_handler::Member_actions_handler ( )

◆ ~Member_actions_handler()

Member_actions_handler::~Member_actions_handler ( )
overridevirtual

Member Function Documentation

◆ acquire_send_service()

bool Member_actions_handler::acquire_send_service ( )

Acquires a reference to the group_replication_message_service_send service.

Returns
Operation status
Return values
falseSuccessful
trueError

◆ deinit()

bool Member_actions_handler::deinit ( )

De-initialize the handler.

Returns
Operation status
Return values
falseSuccessful
trueError

◆ disable_action()

std::pair< bool, std::string > Member_actions_handler::disable_action ( const std::string &  name,
const std::string &  event 
)

Disable a member action for a given event.

Parameters
[in]namethe action name
[in]eventthe event on which the action will be triggered
Returns
std::pair<bool, std::string> where each element has the following meaning: first element of the pair is the function error value: false Successful true Error second element of the pair is the error message.

◆ enable_action()

std::pair< bool, std::string > Member_actions_handler::enable_action ( const std::string &  name,
const std::string &  event 
)

Enable a member action for a given event.

Parameters
[in]namethe action name
[in]eventthe event on which the action will be triggered
Returns
std::pair<bool, std::string> where each element has the following meaning: first element of the pair is the function error value: false Successful true Error second element of the pair is the error message.

◆ force_my_actions_configuration_on_all_members()

bool Member_actions_handler::force_my_actions_configuration_on_all_members ( )

Propagate the local member actions configuration to the group, enabling the force_update flag, which will make the sent configuration to override other members configuration.

Returns
Operation status
Return values
falseSuccessful
trueError

◆ get_all_actions()

bool Member_actions_handler::get_all_actions ( std::string &  serialized_configuration)

Retrieve member actions configuration in the serialized format.

Parameters
[out]serialized_configurationthe serialized configuration
Returns
Operation status
Return values
falseSuccessful
trueError

◆ init()

bool Member_actions_handler::init ( )

Initialize the handler.

Returns
Operation status
Return values
falseSuccessful
trueError

◆ propagate_serialized_configuration()

bool Member_actions_handler::propagate_serialized_configuration ( const std::string &  serialized_configuration)
overrideprivatevirtual

Propagate the serialized configuration to the group.

Parameters
[in]serialized_configurationthe serialized configuration
Returns
the operation status
Return values
falseSuccessful
trueError

Implements Configuration_propagation.

◆ receive()

bool Member_actions_handler::receive ( const char *  tag,
const unsigned char *  data,
size_t  data_length 
)

Delivery method for the group_replication_message_service_recv service.

A error on this method will move the member into ERROR state and follow the –group_replication_exit_state_action option.

Parameters
[in]tagthe message tag
[in]datathe message data
[in]data_lengththe message data length
Returns
Operation status
Return values
falseSuccessful
trueError

◆ release_send_service()

bool Member_actions_handler::release_send_service ( )

Releases the reference to the group_replication_message_service_send service.

Returns
Operation status
Return values
falseSuccessful
trueError

◆ replace_all_actions()

bool Member_actions_handler::replace_all_actions ( const std::vector< std::string > &  exchanged_members_actions_serialized_configuration)

Replace member actions configuration with the given one.

Parameters
[in]exchanged_members_actions_serialized_configurationthe serialized configuration
Returns
Operation status
Return values
falseSuccessful
trueError

◆ reset_to_default_actions_configuration()

bool Member_actions_handler::reset_to_default_actions_configuration ( )

Reset member actions to the default configuration.

Returns
Operation status
Return values
falseSuccessful
trueError

◆ run()

void Member_actions_handler::run ( Mysql_thread_body_parameters parameters)
overridevirtual

Run the actions that were triggered.

Parameters
[in]parametersthe actions parameters

Implements Mysql_thread_body.

◆ run_internal_action()

int Member_actions_handler::run_internal_action ( const protobuf_replication_group_member_actions::Action action)
private

Run a INTERNAL action.

Parameters
[in]actionaction configuration
Returns
the operation status
Return values
falseSuccessful
trueError

◆ trigger_actions()

void Member_actions_handler::trigger_actions ( Member_actions::enum_action_event  event)

Trigger the actions configured to run on the given event.

Parameters
[in]eventthe event that did trigger the member actions

Member Data Documentation

◆ m_configuration

Member_actions_handler_configuration* Member_actions_handler::m_configuration {nullptr}
private

The table configuration abstraction layer.

◆ m_group_replication_message_service_send

mysql_service_group_replication_message_service_send_t* Member_actions_handler::m_group_replication_message_service_send {nullptr}
private

Pointer to the group_replication_message_service_send service.

◆ m_message_service_listener_name

const char* Member_actions_handler::m_message_service_listener_name
private
Initial value:
{
"group_replication_message_service_recv.replication_group_member_"
"actions"}

The name of the message service listener.

◆ m_message_tag

const char* Member_actions_handler::m_message_tag {"mysql_replication_group_member_actions"}
private

The tag used on the messages sent by this class.

◆ m_mysql_thread

Mysql_thread* Member_actions_handler::m_mysql_thread {nullptr}
private

Single thread executor.


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