MySQL 8.4.2
Source Code Documentation
|
The base class to request and execute an election. More...
#include <primary_election_invocation_handler.h>
Public Member Functions | |
Primary_election_handler (ulong components_stop_timeout) | |
Instantiate a new election handler. More... | |
~Primary_election_handler () | |
Class destructor. More... | |
int | request_group_primary_election (std::string primary_uuid, enum_primary_election_mode mode) |
Send a message to all members requesting an election. More... | |
int | handle_primary_election_message (Single_primary_message *message, Notification_context *notification_ctx) |
Handle new received primary message of type SINGLE_PRIMARY_PRIMARY_ELECTION. More... | |
int | execute_primary_election (std::string &primary_uuid, enum_primary_election_mode mode, Notification_context *notification_ctx) |
Execute the primary member selection if needed and the election algorithm invocation. More... | |
void | print_gtid_info_in_log () |
Print server executed GTID and applier retrieved GTID in logs. More... | |
bool | is_an_election_running () |
Is an election process running? More... | |
void | set_election_running (bool election_running) |
Sets if the election process is running or not. More... | |
int | terminate_election_process () |
End any running election process. More... | |
void | notify_election_running () |
Notify transaction consistency manager that election is running. More... | |
void | notify_election_end () |
Notify transaction consistency manager that election ended. More... | |
void | set_stop_wait_timeout (ulong timeout) |
Sets the component stop timeout. More... | |
Private Member Functions | |
bool | pick_primary_member (std::string &primary_uuid, Group_member_info_list *all_members_info) |
Get the member to elect from all group members. More... | |
int | internal_primary_election (std::string &primary_uuid, enum_primary_election_mode mode) |
Execute the standard primary election algorithm (that supports primary appointments) More... | |
int | legacy_primary_election (std::string &primary_uuid) |
Execute the legacy (<8.0.12) primary election algorithm. More... | |
Private Attributes | |
Primary_election_primary_process | primary_election_handler |
The handler to handle the election on the primary member. More... | |
Primary_election_secondary_process | secondary_election_handler |
The handler to handle the election in the secondary members. More... | |
bool | election_process_running |
Is an election running? More... | |
mysql_mutex_t | flag_lock |
The lock for the running flag. More... | |
The base class to request and execute an election.
Primary_election_handler::Primary_election_handler | ( | ulong | components_stop_timeout | ) |
Instantiate a new election handler.
[in] | components_stop_timeout | the timeout when waiting on shutdown |
Primary_election_handler::~Primary_election_handler | ( | ) |
Class destructor.
int Primary_election_handler::execute_primary_election | ( | std::string & | primary_uuid, |
enum_primary_election_mode | mode, | ||
Notification_context * | notification_ctx | ||
) |
Execute the primary member selection if needed and the election algorithm invocation.
primary_uuid | the primary member to elect |
mode | the election mode to use |
notification_ctx | the notification object to report changes |
int Primary_election_handler::handle_primary_election_message | ( | Single_primary_message * | message, |
Notification_context * | notification_ctx | ||
) |
Handle new received primary message of type SINGLE_PRIMARY_PRIMARY_ELECTION.
message | The received primary message |
notification_ctx | the notification object to report changes |
|
private |
Execute the standard primary election algorithm (that supports primary appointments)
primary_uuid | the primary member to elect |
mode | the election mode to use |
Wait for an old process to end
bool Primary_election_handler::is_an_election_running | ( | ) |
Is an election process running?
|
private |
Execute the legacy (<8.0.12) primary election algorithm.
primary_uuid | the primary member to elect |
void Primary_election_handler::notify_election_end | ( | ) |
Notify transaction consistency manager that election ended.
void Primary_election_handler::notify_election_running | ( | ) |
Notify transaction consistency manager that election is running.
|
private |
Get the member to elect from all group members.
This method returns the current primary if one exists If no primary exists this method returns one of the lowest version present in the group according to a weight or uuid criteria.
[out] | primary_uuid | the primary member to elect |
[in] | all_members_info | The members currently in the group |
void Primary_election_handler::print_gtid_info_in_log | ( | ) |
Print server executed GTID and applier retrieved GTID in logs.
int Primary_election_handler::request_group_primary_election | ( | std::string | primary_uuid, |
enum_primary_election_mode | mode | ||
) |
Send a message to all members requesting an election.
primary_uuid | the primary member to elect |
mode | the election mode to use |
void Primary_election_handler::set_election_running | ( | bool | election_running | ) |
Sets if the election process is running or not.
election_running | is the election running or not |
void Primary_election_handler::set_stop_wait_timeout | ( | ulong | timeout | ) |
Sets the component stop timeout.
[in] | timeout | the timeout |
int Primary_election_handler::terminate_election_process | ( | ) |
End any running election process.
|
private |
Is an election running?
|
private |
The lock for the running flag.
|
private |
The handler to handle the election on the primary member.
|
private |
The handler to handle the election in the secondary members.