MySQL 9.1.0
Source Code Documentation
Recovery_metadata_module Class Reference

This class handles the recovery metadata. More...

#include <recovery_metadata.h>

Public Member Functions

 Recovery_metadata_module ()
 Recovery_metadata_module constructor. More...
 
virtual ~Recovery_metadata_module ()
 Recovery_metadata_module Destructor. More...
 
std::pair< std::map< const std::string, Recovery_metadata_message * >::iterator, bool > add_recovery_view_metadata (const std::string &view_id)
 Inserts a new recovery_view_metadata entry for the given VIEW_ID. More...
 
void delete_all_recovery_view_metadata ()
 Deletes all recovery_view_metadata_table elements. More...
 
void delete_members_from_all_recovery_view_metadata_send_metadata_if_sender_left (std::vector< Gcs_member_identifier > &members_left, std::vector< std::string > &view_id_delete_list)
 Remove members not present in given list from all the stored recovery_view_metadata_table records. More...
 
enum_gcs_error send_recovery_metadata (Recovery_metadata_message *recovery_metadata_msg)
 Broadcast message to group members for particular VIEW_ID. More...
 
enum_gcs_error send_error_message (const std::string &view_id)
 Broadcast recovery metadata error message to the group members for particular VIEW_ID. More...
 
void store_joiner_view_id_and_valid_senders (const std::string &view_id, const std::vector< Gcs_member_identifier > &valid_senders)
 Store view-id in which joiner joined along with all the members that were ONLINE at the time of joining. More...
 
void delete_joiner_view_id ()
 Deleted the joiner information i.e. More...
 
void delete_leaving_members_from_joiner_and_leave_group_if_no_valid_sender (const std::vector< Gcs_member_identifier > &leaving, bool is_leaving)
 When member leaves the group, we need to cleanup those members and remove them from valid sender list. More...
 
bool is_joiner_recovery_metadata (const std::string &view_id)
 Returns if recovery metadata view belongs to the joiner. More...
 

Private Member Functions

enum_gcs_error send_error_message_internal (Recovery_metadata_message *recovery_metadata_msg)
 Broadcast error message to group members for particular VIEW_ID. More...
 
void delete_members_from_all_recovery_view_metadata_internal (std::vector< Gcs_member_identifier > &members_left, std::vector< std::string > &view_id_delete_list)
 Remove members that have left the group from valid-sender and valid-joiner list. More...
 
bool delete_recovery_view_metadata_internal (const std::string view_id)
 Remove recovery_view_metadata_table element for the given VIEW_ID. More...
 
void leave_the_group_internal (std::string err_msg)
 Leaves the group. More...
 

Private Attributes

std::map< const std::string, Recovery_metadata_message * > recovery_view_metadata_table
 Stores recovery_view_metadata entry for the given view_id. More...
 
Recovery_metadata_joiner_informationm_recovery_metadata_joiner_information
 Stores the joiner related information i.e. More...
 

Detailed Description

This class handles the recovery metadata.

For safety, processing of add or delete recovery metadata or any processing of recovery metadata like removing group members should be done from pipeline. This class also handles some joiner related information, which is processed from GCS thread directly. This is temporary information and is deleted as soon as recovery metadata is received.

Constructor & Destructor Documentation

◆ Recovery_metadata_module()

Recovery_metadata_module::Recovery_metadata_module ( )

Recovery_metadata_module constructor.

◆ ~Recovery_metadata_module()

Recovery_metadata_module::~Recovery_metadata_module ( )
virtual

Recovery_metadata_module Destructor.

Member Function Documentation

◆ add_recovery_view_metadata()

std::pair< std::map< const std::string, Recovery_metadata_message * >::iterator, bool > Recovery_metadata_module::add_recovery_view_metadata ( const std::string &  view_id)

Inserts a new recovery_view_metadata entry for the given VIEW_ID.

Parameters
view_idView ID of metadata
Returns
the insert success status
Return values
truereturns a pair of an iterator to the newly inserted element and a value of true
falsereturns a pair of an iterator pointing to map end() and a value of false

◆ delete_all_recovery_view_metadata()

void Recovery_metadata_module::delete_all_recovery_view_metadata ( )

Deletes all recovery_view_metadata_table elements.

◆ delete_joiner_view_id()

void Recovery_metadata_module::delete_joiner_view_id ( )

Deleted the joiner information i.e.

view-id and valid sender list. m_recovery_metadata_joiner_information object will be deleted.

◆ delete_leaving_members_from_joiner_and_leave_group_if_no_valid_sender()

void Recovery_metadata_module::delete_leaving_members_from_joiner_and_leave_group_if_no_valid_sender ( const std::vector< Gcs_member_identifier > &  leaving,
bool  is_leaving 
)

When member leaves the group, we need to cleanup those members and remove them from valid sender list.

If post cleanup there are no members that have joiner recovery metadata, joiner leaves the group.

Parameters
leavinglist of members that have left the group
is_leavingif joiner is also leaving the group

◆ delete_members_from_all_recovery_view_metadata_internal()

void Recovery_metadata_module::delete_members_from_all_recovery_view_metadata_internal ( std::vector< Gcs_member_identifier > &  members_left,
std::vector< std::string > &  view_id_delete_list 
)
private

Remove members that have left the group from valid-sender and valid-joiner list.

This function is called from delete_members_from_all_recovery_view_metadata_send_metadata_if_sender_left. If post cleanup there is no valid sender or joiner for the view-id, that view is added to the list of view_id_delete_list for cleanup.

Parameters
members_leftremove members left from the joining member and online member list.
view_id_delete_listList of VIEW-IDs of which metadata is no longer required

◆ delete_members_from_all_recovery_view_metadata_send_metadata_if_sender_left()

void Recovery_metadata_module::delete_members_from_all_recovery_view_metadata_send_metadata_if_sender_left ( std::vector< Gcs_member_identifier > &  members_left,
std::vector< std::string > &  view_id_delete_list 
)

Remove members not present in given list from all the stored recovery_view_metadata_table records.

If post cleanup there is no valid sender or joiner for the view-id this function will do the cleanup for such view-ids. Also, the function does the cleanup of the view-ids mentioned in the parameter view_id_delete_list.

Parameters
members_leftremove members left from the joining member and online member list.
view_id_delete_listList of VIEW-IDs of which metadata is no longer required

◆ delete_recovery_view_metadata_internal()

bool Recovery_metadata_module::delete_recovery_view_metadata_internal ( const std::string  view_id)
private

Remove recovery_view_metadata_table element for the given VIEW_ID.

This function is called from delete_members_from_all_recovery_view_metadata_send_metadata_if_sender_left.

Parameters
view_idView ID of metadata
Returns
the key delete status
Return values
trueKey was not found
falseKey was found and deleted

◆ is_joiner_recovery_metadata()

bool Recovery_metadata_module::is_joiner_recovery_metadata ( const std::string &  view_id)

Returns if recovery metadata view belongs to the joiner.

Parameters
view_idview-id of which metadata has been received
Returns
the send status
Return values
trueYes, joiner metadata
falseNo, other joiner metadata

◆ leave_the_group_internal()

void Recovery_metadata_module::leave_the_group_internal ( std::string  err_msg)
private

Leaves the group.

Parameters
err_msgDetails of why member is leaving the group.

◆ send_error_message()

enum_gcs_error Recovery_metadata_module::send_error_message ( const std::string &  view_id)

Broadcast recovery metadata error message to the group members for particular VIEW_ID.

This message means recovery metadata message cannot be successfully provided to the joiner, so joiner should leave the group and valid senders should cleanup the recovery metadata if saved.

Parameters
view_idView-id for which error has to be send.
Returns
the send status
Return values
trueError
falseSuccess

◆ send_error_message_internal()

enum_gcs_error Recovery_metadata_module::send_error_message_internal ( Recovery_metadata_message recovery_metadata_msg)
private

Broadcast error message to group members for particular VIEW_ID.

Parameters
recovery_metadata_msgpointer to Recovery metadata message store.
Returns
the send status
Return values
trueError
falseSuccess

◆ send_recovery_metadata()

enum_gcs_error Recovery_metadata_module::send_recovery_metadata ( Recovery_metadata_message recovery_metadata_msg)

Broadcast message to group members for particular VIEW_ID.

Parameters
recovery_metadata_msgpointer to Recovery metadata message store.
Returns
the send status
Return values
trueError
falseSuccess

◆ store_joiner_view_id_and_valid_senders()

void Recovery_metadata_module::store_joiner_view_id_and_valid_senders ( const std::string &  view_id,
const std::vector< Gcs_member_identifier > &  valid_senders 
)

Store view-id in which joiner joined along with all the members that were ONLINE at the time of joining.

Parameters
view_idview-id in which joiner joined the group
valid_sendersONLINE members at the time of joining

Member Data Documentation

◆ m_recovery_metadata_joiner_information

Recovery_metadata_joiner_information* Recovery_metadata_module::m_recovery_metadata_joiner_information
private
Initial value:
{
nullptr}

Stores the joiner related information i.e.

view-id and the list of all the members that were ONLINE at the time of joining. The scope of this object is limited, when member joins the group it needs to store it's metadata. Because when recovery metadata is being received joiner needs to identify which recovery metadata it can use to come ONLINE. So joiner temporary stores it view-id and valid sender list in this object till the time it receives it metadata. Post receiving the metadata, this information is not relevant for the joiner, so joiner immediately deletes this information.

◆ recovery_view_metadata_table

std::map<const std::string, Recovery_metadata_message *> Recovery_metadata_module::recovery_view_metadata_table
private

Stores recovery_view_metadata entry for the given view_id.

The record is kept on sender till it is successfully broadcasted.


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