MySQL 8.4.2
Source Code Documentation
|
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_information * | m_recovery_metadata_joiner_information |
Stores the joiner related information i.e. More... | |
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.
Recovery_metadata_module::Recovery_metadata_module | ( | ) |
Recovery_metadata_module constructor.
|
virtual |
Recovery_metadata_module Destructor.
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.
view_id | View ID of metadata |
true | returns a pair of an iterator to the newly inserted element and a value of true |
false | returns a pair of an iterator pointing to map end() and a value of false |
void Recovery_metadata_module::delete_all_recovery_view_metadata | ( | ) |
Deletes all recovery_view_metadata_table elements.
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.
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.
leaving | list of members that have left the group |
is_leaving | if joiner is also leaving the group |
|
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.
members_left | remove members left from the joining member and online member list. |
view_id_delete_list | List of VIEW-IDs of which metadata is no longer required |
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.
members_left | remove members left from the joining member and online member list. |
view_id_delete_list | List of VIEW-IDs of which metadata is no longer required |
|
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.
view_id | View ID of metadata |
true | Key was not found |
false | Key was found and deleted |
bool Recovery_metadata_module::is_joiner_recovery_metadata | ( | const std::string & | view_id | ) |
Returns if recovery metadata view belongs to the joiner.
view_id | view-id of which metadata has been received |
true | Yes, joiner metadata |
false | No, other joiner metadata |
|
private |
Leaves the group.
err_msg | Details of why member is leaving the group. |
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.
view_id | View-id for which error has to be send. |
true | Error |
false | Success |
|
private |
Broadcast error message to group members for particular VIEW_ID.
recovery_metadata_msg | pointer to Recovery metadata message store. |
true | Error |
false | Success |
enum_gcs_error Recovery_metadata_module::send_recovery_metadata | ( | Recovery_metadata_message * | recovery_metadata_msg | ) |
Broadcast message to group members for particular VIEW_ID.
recovery_metadata_msg | pointer to Recovery metadata message store. |
true | Error |
false | Success |
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.
view_id | view-id in which joiner joined the group |
valid_senders | ONLINE members at the time of joining |
|
private |
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.
|
private |
Stores recovery_view_metadata entry for the given view_id.
The record is kept on sender till it is successfully broadcasted.