MySQL 9.0.0
Source Code Documentation
Gcs_xcom_state_exchange Class Reference

Implementation of the gcs_xcom_state_exchange_interface. More...

#include <gcs_xcom_state_exchange.h>

Inheritance diagram for Gcs_xcom_state_exchange:
[legend]

Public Member Functions

 Gcs_xcom_state_exchange (Gcs_communication_interface *comm)
 State Exchange constructor. More...
 
 ~Gcs_xcom_state_exchange () override
 
void init () override
 Accomplishes all necessary initialization steps. More...
 
void reset () override
 If messages were buffered during its processing, they are discarded and internal structures needed are cleaned up. More...
 
void reset_with_flush () override
 Has the same behavior as the reset but additionally flushes buffered messages. More...
 
void end () override
 If messages were buffered during its processing, they are delivered to upper layers and internal structures needed are cleaned up. More...
 
bool state_exchange (synode_no configuration_id, std::vector< Gcs_member_identifier * > &total, std::vector< Gcs_member_identifier * > &left, std::vector< Gcs_member_identifier * > &joined, std::vector< std::unique_ptr< Gcs_message_data > > &exchangeable_data, Gcs_view *current_view, std::string *group, const Gcs_member_identifier &local_info, const Gcs_xcom_nodes &xcom_nodes) override
 Signals the module to start a State Exchange. More...
 
bool process_member_state (Xcom_member_state *ms_info, const Gcs_member_identifier &p_id, Gcs_protocol_version maximum_supported_protocol_version, Gcs_protocol_version used_protocol_version) override
 Processes a member state message on an ongoing State Exchange round. More...
 
std::vector< Gcs_xcom_node_informationcompute_incompatible_members () override
 Compute the set of incompatible members after the state exchange has finished. More...
 
bool process_recovery_state () override
 Recovers any missing packets required for the member to join the group. More...
 
Gcs_xcom_view_identifierget_new_view_id () override
 Retrieves the new view identifier after a State Exchange. More...
 
std::set< Gcs_member_identifier * > * get_joined () override
 
std::set< Gcs_member_identifier * > * get_left () override
 
std::set< Gcs_member_identifier * > * get_total () override
 
std::map< Gcs_member_identifier, Xcom_member_state * > * get_member_states () override
 
std::string * get_group () override
 
void compute_maximum_supported_protocol_version () override
 Computes the maximum protocol version supported by the group. More...
 
- Public Member Functions inherited from Gcs_xcom_state_exchange_interface
virtual ~Gcs_xcom_state_exchange_interface ()=default
 

Private Member Functions

bool is_leaving ()
 Computes if the local member is leaving. More...
 
bool is_joining ()
 Computes if the local member is joining. More...
 
void update_communication_channel (const Gcs_xcom_nodes &xcom_nodes)
 Update the communication system with information on membership. More...
 
enum_gcs_error broadcast_state (const Gcs_xcom_view_identifier &proposed_view, std::vector< std::unique_ptr< Gcs_message_data > > &exchangeable_data)
 Broadcasts the local state to all nodes in the Cluster. More...
 
void update_awaited_vector ()
 Updates the structure that waits for State Exchanges. More...
 
void fill_member_set (std::vector< Gcs_member_identifier * > &in, std::set< Gcs_member_identifier * > &pset)
 Converts xcom data to a set of internal representation. More...
 
void save_member_state (Xcom_member_state *ms_info, const Gcs_member_identifier &p_id, Gcs_protocol_version maximum_supported_protocol_version, Gcs_protocol_version used_protocol_version)
 Stores the member's state and protocol version. More...
 
bool snapshot_is_enough (Gcs_xcom_synode_set const &snapshot_to_recover) const
 Auxiliary method that checks whether snapshot_to_recover contains all the synodes required. More...
 
std::pair< bool, Gcs_protocol_versionmembers_announce_same_version () const
 Checks whether all the existing group members, myself excluded, announce the same protocol version. More...
 
bool incompatible_with_group () const
 Checks whether this server is incompatible with the group. More...
 
std::vector< Gcs_xcom_node_informationcompute_incompatible_joiners ()
 Computes the set of incompatible nodes that are trying to join the group. More...
 
 Gcs_xcom_state_exchange (Gcs_xcom_state_exchange const &)
 
Gcs_xcom_state_exchangeoperator= (Gcs_xcom_state_exchange const &)
 

Private Attributes

Gcs_communication_interfacem_broadcaster
 
std::map< Gcs_member_identifier, uint > m_awaited_vector
 
std::map< Gcs_member_identifier, uint > m_recover_vector
 
std::set< Gcs_member_identifier * > m_ms_total
 
std::set< Gcs_member_identifier * > m_ms_left
 
std::set< Gcs_member_identifier * > m_ms_joined
 
std::map< Gcs_member_identifier, Xcom_member_state * > m_member_states
 
std::map< Gcs_member_identifier, Gcs_protocol_versionm_member_versions
 
std::map< Gcs_member_identifier, Gcs_protocol_versionm_member_max_versions
 
std::string * m_group_name
 
Gcs_member_identifier m_local_information
 
synode_no m_configuration_id
 
std::vector< synode_no > cached_ids
 
Gcs_xcom_nodes m_ms_xcom_nodes
 

Detailed Description

Implementation of the gcs_xcom_state_exchange_interface.

Constructor & Destructor Documentation

◆ Gcs_xcom_state_exchange() [1/2]

Gcs_xcom_state_exchange::Gcs_xcom_state_exchange ( Gcs_communication_interface comm)
explicit

State Exchange constructor.

Parameters
[in]commCommunication interface reference to allow broadcasting of member states

◆ ~Gcs_xcom_state_exchange()

Gcs_xcom_state_exchange::~Gcs_xcom_state_exchange ( )
override

◆ Gcs_xcom_state_exchange() [2/2]

Gcs_xcom_state_exchange::Gcs_xcom_state_exchange ( Gcs_xcom_state_exchange const &  )
private

Member Function Documentation

◆ broadcast_state()

enum_gcs_error Gcs_xcom_state_exchange::broadcast_state ( const Gcs_xcom_view_identifier proposed_view,
std::vector< std::unique_ptr< Gcs_message_data > > &  exchangeable_data 
)
private

Broadcasts the local state to all nodes in the Cluster.

Parameters
[in]proposed_viewproposed view to broadcast
[in]exchangeable_dataList with exchangeable messages

◆ compute_incompatible_joiners()

std::vector< Gcs_xcom_node_information > Gcs_xcom_state_exchange::compute_incompatible_joiners ( )
private

Computes the set of incompatible nodes that are trying to join the group.

Returns
the set of incompatible joiners

◆ compute_incompatible_members()

std::vector< Gcs_xcom_node_information > Gcs_xcom_state_exchange::compute_incompatible_members ( )
overridevirtual

Compute the set of incompatible members after the state exchange has finished.

A member M is incompatible if it is attempting to join a group that is using protocol X, but M is using protocol Y s.t. X != Y.

Returns
the set of incompatible members

Implements Gcs_xcom_state_exchange_interface.

◆ compute_maximum_supported_protocol_version()

void Gcs_xcom_state_exchange::compute_maximum_supported_protocol_version ( )
overridevirtual

Computes the maximum protocol version supported by the group.

Implements Gcs_xcom_state_exchange_interface.

◆ end()

void Gcs_xcom_state_exchange::end ( )
overridevirtual

If messages were buffered during its processing, they are delivered to upper layers and internal structures needed are cleaned up.

Implements Gcs_xcom_state_exchange_interface.

◆ fill_member_set()

void Gcs_xcom_state_exchange::fill_member_set ( std::vector< Gcs_member_identifier * > &  in,
std::set< Gcs_member_identifier * > &  pset 
)
private

Converts xcom data to a set of internal representation.

Parameters
[in]inxcom list
[in]psetSet where the converted member ids will be written

◆ get_group()

std::string * Gcs_xcom_state_exchange::get_group ( )
inlineoverridevirtual
Returns
the group in which this State Exchange is occurring

Implements Gcs_xcom_state_exchange_interface.

◆ get_joined()

std::set< Gcs_member_identifier * > * Gcs_xcom_state_exchange::get_joined ( )
inlineoverridevirtual
Returns
the members that joined in this State Exchange round

Implements Gcs_xcom_state_exchange_interface.

◆ get_left()

std::set< Gcs_member_identifier * > * Gcs_xcom_state_exchange::get_left ( )
inlineoverridevirtual
Returns
the members that left in this State Exchange round

Implements Gcs_xcom_state_exchange_interface.

◆ get_member_states()

std::map< Gcs_member_identifier, Xcom_member_state * > * Gcs_xcom_state_exchange::get_member_states ( )
inlineoverridevirtual
Returns
the saved states

Implements Gcs_xcom_state_exchange_interface.

◆ get_new_view_id()

Gcs_xcom_view_identifier * Gcs_xcom_state_exchange::get_new_view_id ( )
overridevirtual

Retrieves the new view identifier after a State Exchange.

Returns
the new view identifier

Implements Gcs_xcom_state_exchange_interface.

◆ get_total()

std::set< Gcs_member_identifier * > * Gcs_xcom_state_exchange::get_total ( )
inlineoverridevirtual
Returns
All the members in this State Exchange round

Implements Gcs_xcom_state_exchange_interface.

◆ incompatible_with_group()

bool Gcs_xcom_state_exchange::incompatible_with_group ( ) const
private

Checks whether this server is incompatible with the group.

Return values
trueIf it is incompatible
falseIf it is compatible

◆ init()

void Gcs_xcom_state_exchange::init ( )
overridevirtual

Accomplishes all necessary initialization steps.

Implements Gcs_xcom_state_exchange_interface.

◆ is_joining()

bool Gcs_xcom_state_exchange::is_joining ( )
private

Computes if the local member is joining.

Returns
true in case of the local member is joining

◆ is_leaving()

bool Gcs_xcom_state_exchange::is_leaving ( )
private

Computes if the local member is leaving.

Returns
true in case of the local member is leaving

◆ members_announce_same_version()

std::pair< bool, Gcs_protocol_version > Gcs_xcom_state_exchange::members_announce_same_version ( ) const
private

Checks whether all the existing group members, myself excluded, announce the same protocol version.

Return values
{false,_}if they do not all announce the same protocol version
{true,Gcs_protocol_version}if they all announced the same protocol version of the return value

◆ operator=()

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

◆ process_member_state()

bool Gcs_xcom_state_exchange::process_member_state ( Xcom_member_state ms_info,
const Gcs_member_identifier p_id,
Gcs_protocol_version  maximum_supported_protocol_version,
Gcs_protocol_version  used_protocol_version 
)
overridevirtual

Processes a member state message on an ongoing State Exchange round.

Parameters
[in]ms_inforeceived Member State
[in]p_idthe node that the Member State pertains
[in]maximum_supported_protocol_versionmaximum supported protocol version
[in]used_protocol_versionprotocol version in use by a member during the state exchange phase
Returns
true if State Exchanged is to be finished and the view can be installed

Implements Gcs_xcom_state_exchange_interface.

◆ process_recovery_state()

bool Gcs_xcom_state_exchange::process_recovery_state ( )
overridevirtual

Recovers any missing packets required for the member to join the group.

Return values
trueif successful
falseotherwise

Implements Gcs_xcom_state_exchange_interface.

◆ reset()

void Gcs_xcom_state_exchange::reset ( )
overridevirtual

If messages were buffered during its processing, they are discarded and internal structures needed are cleaned up.

Implements Gcs_xcom_state_exchange_interface.

◆ reset_with_flush()

void Gcs_xcom_state_exchange::reset_with_flush ( )
overridevirtual

Has the same behavior as the reset but additionally flushes buffered messages.

Implements Gcs_xcom_state_exchange_interface.

◆ save_member_state()

void Gcs_xcom_state_exchange::save_member_state ( Xcom_member_state ms_info,
const Gcs_member_identifier p_id,
Gcs_protocol_version  maximum_supported_protocol_version,
Gcs_protocol_version  used_protocol_version 
)
private

Stores the member's state and protocol version.

Parameters
ms_infostate
p_idmember
[in]maximum_supported_protocol_versionmaximum supported protocol version
used_protocol_versionprotocol version

◆ snapshot_is_enough()

bool Gcs_xcom_state_exchange::snapshot_is_enough ( Gcs_xcom_synode_set const &  snapshot_to_recover) const
private

Auxiliary method that checks whether snapshot_to_recover contains all the synodes required.

◆ state_exchange()

bool Gcs_xcom_state_exchange::state_exchange ( synode_no  configuration_id,
std::vector< Gcs_member_identifier * > &  total,
std::vector< Gcs_member_identifier * > &  left,
std::vector< Gcs_member_identifier * > &  joined,
std::vector< std::unique_ptr< Gcs_message_data > > &  exchangeable_data,
Gcs_view current_view,
std::string *  group,
const Gcs_member_identifier local_info,
const Gcs_xcom_nodes xcom_nodes 
)
overridevirtual

Signals the module to start a State Exchange.

Parameters
[in]configuration_idConfiguration identifier in use when the state exchange phase started
[in]totalxcom total members in the new view
[in]leftxcom members that left in the new view
[in]joinedxcom members that joined in the new view
[in]exchangeable_datageneric exchanged data
[in]current_viewthe currently installed view
[in]groupgroup name
[in]local_infothe local GCS member identifier
[in]xcom_nodeslist of nodes
Returns
true if the member is leaving

Implements Gcs_xcom_state_exchange_interface.

◆ update_awaited_vector()

void Gcs_xcom_state_exchange::update_awaited_vector ( )
private

Updates the structure that waits for State Exchanges.

◆ update_communication_channel()

void Gcs_xcom_state_exchange::update_communication_channel ( const Gcs_xcom_nodes xcom_nodes)
private

Update the communication system with information on membership.

Parameters
xcom_nodesList of nodes that belong to the current membership.

Member Data Documentation

◆ cached_ids

std::vector<synode_no> Gcs_xcom_state_exchange::cached_ids
private

◆ m_awaited_vector

std::map<Gcs_member_identifier, uint> Gcs_xcom_state_exchange::m_awaited_vector
private

◆ m_broadcaster

Gcs_communication_interface* Gcs_xcom_state_exchange::m_broadcaster
private

◆ m_configuration_id

synode_no Gcs_xcom_state_exchange::m_configuration_id
private

◆ m_group_name

std::string* Gcs_xcom_state_exchange::m_group_name
private

◆ m_local_information

Gcs_member_identifier Gcs_xcom_state_exchange::m_local_information
private

◆ m_member_max_versions

std::map<Gcs_member_identifier, Gcs_protocol_version> Gcs_xcom_state_exchange::m_member_max_versions
private

◆ m_member_states

std::map<Gcs_member_identifier, Xcom_member_state *> Gcs_xcom_state_exchange::m_member_states
private

◆ m_member_versions

std::map<Gcs_member_identifier, Gcs_protocol_version> Gcs_xcom_state_exchange::m_member_versions
private

◆ m_ms_joined

std::set<Gcs_member_identifier *> Gcs_xcom_state_exchange::m_ms_joined
private

◆ m_ms_left

std::set<Gcs_member_identifier *> Gcs_xcom_state_exchange::m_ms_left
private

◆ m_ms_total

std::set<Gcs_member_identifier *> Gcs_xcom_state_exchange::m_ms_total
private

◆ m_ms_xcom_nodes

Gcs_xcom_nodes Gcs_xcom_state_exchange::m_ms_xcom_nodes
private

◆ m_recover_vector

std::map<Gcs_member_identifier, uint> Gcs_xcom_state_exchange::m_recover_vector
private

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