MySQL 8.0.39
Source Code Documentation
Gcs_xcom_group_management Class Reference

#include <gcs_xcom_group_management.h>

Inheritance diagram for Gcs_xcom_group_management:
[legend]

Public Member Functions

 Gcs_xcom_group_management (Gcs_xcom_proxy *xcom_proxy, const Gcs_group_identifier &group_identifier, Gcs_xcom_view_change_control_interface *view_control)
 
 ~Gcs_xcom_group_management () override
 
enum_gcs_error modify_configuration (const Gcs_interface_parameters &reconfigured_group) override
 Method that allows sending of a new group configuration. More...
 
enum_gcs_error get_write_concurrency (uint32_t &event_horizon) const override
 Retrieves the group's "write concurrency" value. More...
 
enum_gcs_error set_write_concurrency (uint32_t event_horizon) override
 Reconfigures the group's "write concurrency" value. More...
 
enum_gcs_error set_single_leader (Gcs_member_identifier const &leader) override
 Reconfigures the group's "consensus leaders.". More...
 
enum_gcs_error set_everyone_leader () override
 Reconfigures the group's "consensus leaders.". More...
 
enum_gcs_error get_leaders (std::vector< Gcs_member_identifier > &preferred_leaders, std::vector< Gcs_member_identifier > &actual_leaders) override
 Inspect the group's "consensus leader" configuration. More...
 
uint32_t get_minimum_write_concurrency () const override
 Retrieves the minimum supported "write concurrency" value. More...
 
uint32_t get_maximum_write_concurrency () const override
 Retrieves the maximum supported "write concurrency" value. More...
 
void set_xcom_nodes (const Gcs_xcom_nodes &xcom_nodes)
 Save information on the latest nodes seen by this node so that it can safely reconfigure the group if it loses the majority. More...
 
void get_xcom_nodes (Gcs_xcom_nodes &result_xcom_nodes, const std::vector< std::string > &filter)
 
void get_xcom_nodes (Gcs_xcom_nodes &result_xcom_nodes, const std::vector< Gcs_member_identifier > &filter)
 
void get_xcom_nodes (Gcs_xcom_nodes &result_xcom_nodes, const std::vector< Gcs_member_identifier * > &filter)
 
- Public Member Functions inherited from Gcs_group_management_interface
virtual ~Gcs_group_management_interface ()=default
 

Private Member Functions

 Gcs_xcom_group_management (Gcs_xcom_group_management const &)
 
Gcs_xcom_group_managementoperator= (Gcs_xcom_group_management const &)
 

Private Attributes

Gcs_xcom_proxym_xcom_proxy
 
Gcs_group_identifierm_gid
 
Gcs_xcom_nodes m_xcom_nodes
 
unsigned int m_gid_hash
 
My_xp_mutex_impl m_nodes_mutex
 
Gcs_xcom_view_change_control_interfacem_view_control
 

Constructor & Destructor Documentation

◆ Gcs_xcom_group_management() [1/2]

Gcs_xcom_group_management::Gcs_xcom_group_management ( Gcs_xcom_proxy xcom_proxy,
const Gcs_group_identifier group_identifier,
Gcs_xcom_view_change_control_interface view_control 
)
explicit

◆ ~Gcs_xcom_group_management()

Gcs_xcom_group_management::~Gcs_xcom_group_management ( )
override

◆ Gcs_xcom_group_management() [2/2]

Gcs_xcom_group_management::Gcs_xcom_group_management ( Gcs_xcom_group_management const &  )
private

Member Function Documentation

◆ get_leaders()

enum_gcs_error Gcs_xcom_group_management::get_leaders ( std::vector< Gcs_member_identifier > &  preferred_leaders,
std::vector< Gcs_member_identifier > &  actual_leaders 
)
overridevirtual

Inspect the group's "consensus leader" configuration.

Parameters
[out]preferred_leadersThe members specified as preferred leaders.
[out]actual_leadersThe members actually carrying out the leader role at this moment.
Return values
GCS_OKif successful, preferred_leaders and actual_leaders contain the result
GCS_NOKif unsuccessful

Implements Gcs_group_management_interface.

◆ get_maximum_write_concurrency()

uint32_t Gcs_xcom_group_management::get_maximum_write_concurrency ( ) const
overridevirtual

Retrieves the maximum supported "write concurrency" value.

Implements Gcs_group_management_interface.

◆ get_minimum_write_concurrency()

uint32_t Gcs_xcom_group_management::get_minimum_write_concurrency ( ) const
overridevirtual

Retrieves the minimum supported "write concurrency" value.

Implements Gcs_group_management_interface.

◆ get_write_concurrency()

enum_gcs_error Gcs_xcom_group_management::get_write_concurrency ( uint32_t &  write_concurrency) const
overridevirtual

Retrieves the group's "write concurrency" value.

Parameters
[out]write_concurrencyA reference to where the group's "write concurrency" value will be written to
Return values
GCS_OKif successful and write_concurrency has been written to
GCS_NOKif GCS was unable to request the current "write concurrency" value from the underlying implementation

Implements Gcs_group_management_interface.

◆ get_xcom_nodes() [1/3]

void Gcs_xcom_group_management::get_xcom_nodes ( Gcs_xcom_nodes result_xcom_nodes,
const std::vector< Gcs_member_identifier * > &  filter 
)

◆ get_xcom_nodes() [2/3]

void Gcs_xcom_group_management::get_xcom_nodes ( Gcs_xcom_nodes result_xcom_nodes,
const std::vector< Gcs_member_identifier > &  filter 
)

◆ get_xcom_nodes() [3/3]

void Gcs_xcom_group_management::get_xcom_nodes ( Gcs_xcom_nodes result_xcom_nodes,
const std::vector< std::string > &  filter 
)

◆ modify_configuration()

enum_gcs_error Gcs_xcom_group_management::modify_configuration ( const Gcs_interface_parameters reconfigured_group)
overridevirtual

Method that allows sending of a new group configuration.

This is to be used when the group is blocked due to a loss of majority and only on one node from the new group.

Implementations in each binding might have there specificities but some rules must be followed:

  • This should be a non-blocking call;
  • Typically, it shall cause a View Change, since we are forcing a new configuration.
Parameters
[in]reconfigured_groupa list containing the new nodes

Implements Gcs_group_management_interface.

◆ operator=()

Gcs_xcom_group_management & Gcs_xcom_group_management::operator= ( Gcs_xcom_group_management const &  )
private

◆ set_everyone_leader()

enum_gcs_error Gcs_xcom_group_management::set_everyone_leader ( )
overridevirtual

Reconfigures the group's "consensus leaders.".

Instructs the underlying GCS to use every member as a consensus leader.

Return values
GCS_OKif successful
GCS_NOKif unsuccessful

Implements Gcs_group_management_interface.

◆ set_single_leader()

enum_gcs_error Gcs_xcom_group_management::set_single_leader ( Gcs_member_identifier const &  leader)
overridevirtual

Reconfigures the group's "consensus leaders.".

Instructs the underlying GCS to use leader as the single preferred consensus leader.

Parameters
leaderThe member you desire to act as a consensus leader.
Return values
GCS_OKif successful
GCS_NOKif unsuccessful

Implements Gcs_group_management_interface.

◆ set_write_concurrency()

enum_gcs_error Gcs_xcom_group_management::set_write_concurrency ( uint32_t  write_concurrency)
overridevirtual

Reconfigures the group's "write concurrency" value.

The caller should ensure that the supplied value is between minimum_write_concurrency and maximum_write_concurrency.

The method is non-blocking, meaning that it shall only send the request to an underlying GCS. The final result can be polled via get_write_concurrency.

Parameters
write_concurrencyThe desired "write concurrency" value.
Return values
GCS_OKif successful
GCS_NOKif unsuccessful

Implements Gcs_group_management_interface.

◆ set_xcom_nodes()

void Gcs_xcom_group_management::set_xcom_nodes ( const Gcs_xcom_nodes xcom_nodes)

Save information on the latest nodes seen by this node so that it can safely reconfigure the group if it loses the majority.

This information is required to extract the set of possible alive nodes and their UUIDs. If the UUIDs in the reconfiguration request do not match those stored in XCOM, it will not allow the reconfiguration to proceed.

Note also that the set of nodes is updated by the MySQL GCS thread whenever a new configuration is delivered and that a user thread is responsible for calling the reconfiguration process. If a user is trying to reconfigure the system, this usually and unfortunately means that it has lost the majority and nothing will be updated by the MySQL GCS thread. However, just for the sake of completeness, we will use a mutex here to control access to this data structure.

Finally, it is worth noting that we cannot use get_site_def() here because information on nodes could be concurrently updated by the XCOM thread and we cannot add a mutex to it.

Member Data Documentation

◆ m_gid

Gcs_group_identifier* Gcs_xcom_group_management::m_gid
private

◆ m_gid_hash

unsigned int Gcs_xcom_group_management::m_gid_hash
private

◆ m_nodes_mutex

My_xp_mutex_impl Gcs_xcom_group_management::m_nodes_mutex
private

◆ m_view_control

Gcs_xcom_view_change_control_interface* Gcs_xcom_group_management::m_view_control
private

◆ m_xcom_nodes

Gcs_xcom_nodes Gcs_xcom_group_management::m_xcom_nodes
private

◆ m_xcom_proxy

Gcs_xcom_proxy* Gcs_xcom_group_management::m_xcom_proxy
private

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