MySQL 9.1.0
Source Code Documentation
|
Deals with the orchestration necessary to set the appropriate "consensus leaders" on GCS. More...
#include <consensus_leaders_handler.h>
Public Member Functions | |
Consensus_leaders_handler (Group_events_observation_manager &group_events_manager) | |
Register as a group event observer in group_events_manager . More... | |
~Consensus_leaders_handler () override | |
Unregister as a group event observer from m_group_events_manager . More... | |
int | after_view_change (const std::vector< Gcs_member_identifier > &joining, const std::vector< Gcs_member_identifier > &leaving, const std::vector< Gcs_member_identifier > &group, bool is_leaving, bool *skip_election, enum_primary_election_mode *election_mode, std::string &suggested_primary) override |
Executed after view install and before primary election. More... | |
int | after_primary_election (std::string primary_uuid, enum_primary_election_primary_change_status primary_change_status, enum_primary_election_mode election_mode, int error) override |
Sets the newly elected primary as the single preferred "consensus
leader" in GCS. More... | |
int | before_message_handling (const Plugin_gcs_message &message, const std::string &message_origin, bool *skip_message) override |
Executed before the message is processed. More... | |
void | set_consensus_leaders (Member_version const &communication_protocol, bool is_single_primary_mode, Group_member_info::Group_member_role role, Gcs_member_identifier const &my_gcs_id, std::function< bool()> allow_single_leader_getter) |
Set the appropriate "consensus leaders" in GCS. More... | |
void | set_consensus_leaders (Member_version const &communication_protocol, bool is_single_primary_mode, Group_member_info::Group_member_role role, Gcs_member_identifier const &my_gcs_id) |
Set the appropriate "consensus leaders" in GCS. More... | |
Public Member Functions inherited from Group_event_observer | |
virtual | ~Group_event_observer ()=0 |
Private Member Functions | |
void | set_as_single_consensus_leader (Gcs_member_identifier const &leader) const |
void | set_everyone_as_consensus_leader () const |
Private Attributes | |
Group_events_observation_manager & | m_group_events_manager |
Static Private Attributes | |
static Member_version const | s_first_protocol_with_support_for_consensus_leaders |
Deals with the orchestration necessary to set the appropriate "consensus leaders" on GCS.
Reacts to successful primary elections by setting the newly elected primary as the single preferred "consensus leader" in GCS.
Consensus_leaders_handler::Consensus_leaders_handler | ( | Group_events_observation_manager & | group_events_manager | ) |
Register as a group event observer in group_events_manager
.
First member version where we have XCom's single leader.
|
override |
Unregister as a group event observer from m_group_events_manager
.
|
overridevirtual |
Sets the newly elected primary as the single preferred "consensus leader" in GCS.
primary_uuid | the elected primary |
primary_change_status | if the primary changed after the election |
election_mode | what was the election mode |
error | if there was and error on the process |
Implements Group_event_observer.
|
overridevirtual |
Executed after view install and before primary election.
joining | members joining the group | |
leaving | members leaving the group | |
group | members in the group | |
is_leaving | is the member leaving | |
[out] | skip_election | skip primary election on view |
[out] | election_mode | election mode |
[out] | suggested_primary | what should be the next primary to elect |
Implements Group_event_observer.
|
overridevirtual |
Executed before the message is processed.
message | The GCS message | |
message_origin | The member that sent this message (address) | |
[out] | skip_message | skip message handling if true |
Implements Group_event_observer.
|
private |
void Consensus_leaders_handler::set_consensus_leaders | ( | Member_version const & | communication_protocol, |
bool | is_single_primary_mode, | ||
Group_member_info::Group_member_role | role, | ||
Gcs_member_identifier const & | my_gcs_id | ||
) |
Set the appropriate "consensus leaders" in GCS.
The "consensus leaders" are set according to the following rules: a) communication_protocol
is < 8.0.27: do nothing b) communication_protocol
is >= 8.0.27: b1) primary_mode
is SINGLE and my_role
is PRIMARY: set myself, my_gcs_id
, as the single preferred "consensus leader" b2) primary_mode
is SINGLE and my_role
is SECONDARY: do nothing b3) primary_mode
is MULTI: set everyone as "consensus leader"
It inserts a default implementation of allow_single_leader_getter that verifies the current value of group_replication_paxos_single_leader var
void Consensus_leaders_handler::set_consensus_leaders | ( | Member_version const & | communication_protocol, |
bool | is_single_primary_mode, | ||
Group_member_info::Group_member_role | role, | ||
Gcs_member_identifier const & | my_gcs_id, | ||
std::function< bool()> | allow_single_leader_getter | ||
) |
Set the appropriate "consensus leaders" in GCS.
The "consensus leaders" are set according to the following rules: 0) If the the return result of allow_single_leader_getter lambda is false :do nothing a) communication_protocol
is < 8.0.27: do nothing b) communication_protocol
is >= 8.0.27: b1) primary_mode
is SINGLE and my_role
is PRIMARY: set myself, my_gcs_id
, as the single preferred "consensus leader" b2) primary_mode
is SINGLE and my_role
is SECONDARY: do nothing b3) primary_mode
is MULTI: set everyone as "consensus leader"
|
private |
|
private |
|
staticprivate |