MySQL 9.1.0
Source Code Documentation
|
Class that contains the primary election process logic for the elected primary. More...
#include <primary_election_primary_process.h>
Public Member Functions | |
Primary_election_primary_process () | |
Class constructor for primary election process. More... | |
~Primary_election_primary_process () override | |
Class destructor for primary election process. More... | |
int | launch_primary_election_process (enum_primary_election_mode election_mode, std::string &primary_to_elect, Group_member_info_list *group_members_info) |
Launch the local process on the primary member for primary election. More... | |
bool | is_election_process_running () |
Is the election process running? More... | |
bool | is_election_process_terminating () |
Is the process already terminating? More... | |
int | terminate_election_process (bool wait=true) |
Terminate the election process on shutdown. More... | |
void | wait_on_election_process_termination () |
Waits for the election thread process to finish. More... | |
int | primary_election_process_handler () |
void | set_stop_wait_timeout (ulong timeout) |
Sets the component stop timeout. More... | |
Public Member Functions inherited from Group_event_observer | |
virtual | ~Group_event_observer ()=0 |
Private Member Functions | |
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 |
Executed after primary election. 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... | |
bool | signal_read_mode_ready () |
Signal that the read mode is ready on this member. More... | |
Private Attributes | |
std::shared_ptr< Continuation > | applier_checkpoint_condition |
Continuation object to wait on the applier queue consumption. More... | |
thread_state | election_process_thd_state |
The election thread status. More... | |
bool | election_process_aborted |
Is the process aborted. More... | |
bool | primary_ready |
bool | group_in_read_mode |
Are all group members in read mode. More... | |
bool | waiting_on_queue_applied_message |
Waiting for old primary transaction execution. More... | |
bool | election_process_ending |
Are the main stages of the election process finished. More... | |
enum_primary_election_mode | election_mode |
The election invocation context. More... | |
std::string | primary_uuid |
The primary to be elected. More... | |
ulong | number_of_know_members |
The number of known members when the election started. More... | |
std::list< std::string > | known_members_addresses |
The members known for the current action. More... | |
Plugin_stage_monitor_handler * | stage_handler |
The stage handler for progress reporting. More... | |
ulong | stop_wait_timeout |
mysql_mutex_t | election_lock |
The thread run lock. More... | |
mysql_cond_t | election_cond |
The thread run condition. More... | |
my_thread_handle | primary_election_pthd |
The thread handle. More... | |
Class that contains the primary election process logic for the elected primary.
Primary_election_primary_process::Primary_election_primary_process | ( | ) |
Class constructor for primary election process.
|
override |
Class destructor for primary election process.
|
overrideprivatevirtual |
Executed after primary election.
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.
|
overrideprivatevirtual |
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.
|
overrideprivatevirtual |
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.
bool Primary_election_primary_process::is_election_process_running | ( | ) |
Is the election process running?
bool Primary_election_primary_process::is_election_process_terminating | ( | ) |
Is the process already terminating?
int Primary_election_primary_process::launch_primary_election_process | ( | enum_primary_election_mode | election_mode, |
std::string & | primary_to_elect, | ||
Group_member_info_list * | group_members_info | ||
) |
Launch the local process on the primary member for primary election.
election_mode | the context on which election is occurring |
primary_to_elect | the uuid of the primary to elect |
group_members_info | the member info about group members |
int Primary_election_primary_process::primary_election_process_handler | ( | ) |
Wait for own message so we unset the read mode when the certification packet was already queued
Note that we also send a message from us so the decision is always in a group logical moment, even if only a member exists
Why wait for the receiving of this message? So we can declare the election process as stopped in all member at the same logical moment. This is important for group configuration actions that can't start in parallel.
Note however that this packet is going to be applied asynchronously and disable certification so configuration actions should be aware of that
void Primary_election_primary_process::set_stop_wait_timeout | ( | ulong | timeout | ) |
Sets the component stop timeout.
[in] | timeout | the timeout |
|
private |
Signal that the read mode is ready on this member.
int Primary_election_primary_process::terminate_election_process | ( | bool | wait = true | ) |
Terminate the election process on shutdown.
wait | should it wait for the process to finish (default true). |
void Primary_election_primary_process::wait_on_election_process_termination | ( | ) |
Waits for the election thread process to finish.
|
private |
Continuation object to wait on the applier queue consumption.
|
private |
The thread run condition.
|
private |
The thread run lock.
|
private |
The election invocation context.
|
private |
Is the process aborted.
|
private |
Are the main stages of the election process finished.
|
private |
The election thread status.
|
private |
Are all group members in read mode.
|
private |
The members known for the current action.
|
private |
The number of known members when the election started.
|
private |
The thread handle.
|
private |
|
private |
The primary to be elected.
|
private |
The stage handler for progress reporting.
|
private |
|
private |
Waiting for old primary transaction execution.