MySQL 8.0.40
Source Code Documentation
Primary_election_secondary_process Class Reference

Class that contains the primary election process logic for secondary members. More...

#include <primary_election_secondary_process.h>

Inheritance diagram for Primary_election_secondary_process:
[legend]

Public Member Functions

 Primary_election_secondary_process ()
 Class constructor for secondary election process. More...
 
 ~Primary_election_secondary_process () override
 Class destructor for secondary election process. More...
 
int launch_secondary_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 secondary members for primary election. More...
 
bool is_election_process_running ()
 Is the election process running? More...
 
int terminate_election_process (bool wait=true)
 Terminate the election process on shutdown. More...
 
int secondary_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 enable_read_mode_on_server ()
 Enables the read mode in the server. More...
 
bool signal_read_mode_ready ()
 Signal that the read mode is ready on this member. More...
 

Private Attributes

thread_state election_process_thd_state
 The election thread status. More...
 
bool election_process_aborted
 Is the process aborted. More...
 
bool waiting_on_old_primary_transactions
 Waiting for old primary transaction execution. More...
 
bool primary_ready
 
bool group_in_read_mode
 Are all group members in read mode. More...
 
bool is_waiting_on_read_mode_group
 Process is waiting on read mode - stage related var. 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_handlerstage_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...
 

Detailed Description

Class that contains the primary election process logic for secondary members.

Constructor & Destructor Documentation

◆ Primary_election_secondary_process()

Primary_election_secondary_process::Primary_election_secondary_process ( )

Class constructor for secondary election process.

◆ ~Primary_election_secondary_process()

Primary_election_secondary_process::~Primary_election_secondary_process ( )
override

Class destructor for secondary election process.

Member Function Documentation

◆ after_primary_election()

int Primary_election_secondary_process::after_primary_election ( std::string  primary_uuid,
enum_primary_election_primary_change_status  primary_change_status,
enum_primary_election_mode  election_mode,
int  error 
)
overrideprivatevirtual

Executed after primary election.

Parameters
primary_uuidthe elected primary
primary_change_statusif the primary changed after the election
election_modewhat was the election mode
errorif there was and error on the process

Implements Group_event_observer.

◆ after_view_change()

int Primary_election_secondary_process::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 
)
overrideprivatevirtual

Executed after view install and before primary election.

Parameters
joiningmembers joining the group
leavingmembers leaving the group
groupmembers in the group
is_leavingis the member leaving
[out]skip_electionskip primary election on view
[out]election_modeelection mode
[out]suggested_primarywhat should be the next primary to elect

Implements Group_event_observer.

◆ before_message_handling()

int Primary_election_secondary_process::before_message_handling ( const Plugin_gcs_message message,
const std::string &  message_origin,
bool *  skip_message 
)
overrideprivatevirtual

Executed before the message is processed.

Parameters
messageThe GCS message
message_originThe member that sent this message (address)
[out]skip_messageskip message handling if true

Implements Group_event_observer.

◆ enable_read_mode_on_server()

bool Primary_election_secondary_process::enable_read_mode_on_server ( )
private

Enables the read mode in the server.

Returns
false in case of success, or true otherwise

◆ is_election_process_running()

bool Primary_election_secondary_process::is_election_process_running ( )

Is the election process running?

Returns
election_process_running

◆ launch_secondary_election_process()

int Primary_election_secondary_process::launch_secondary_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 secondary members for primary election.

Parameters
election_modethe context on which election is occurring
primary_to_electthe uuid of the primary to elect
group_members_infothe member info about group members
Returns
0 in case of success, or 1 otherwise

◆ secondary_election_process_handler()

int Primary_election_secondary_process::secondary_election_process_handler ( )

◆ set_stop_wait_timeout()

void Primary_election_secondary_process::set_stop_wait_timeout ( ulong  timeout)

Sets the component stop timeout.

Parameters
[in]timeoutthe timeout

◆ signal_read_mode_ready()

bool Primary_election_secondary_process::signal_read_mode_ready ( )
private

Signal that the read mode is ready on this member.

Returns
false in case of success, or true otherwise

◆ terminate_election_process()

int Primary_election_secondary_process::terminate_election_process ( bool  wait = true)

Terminate the election process on shutdown.

Member Data Documentation

◆ election_cond

mysql_cond_t Primary_election_secondary_process::election_cond
private

The thread run condition.

◆ election_lock

mysql_mutex_t Primary_election_secondary_process::election_lock
private

The thread run lock.

◆ election_mode

enum_primary_election_mode Primary_election_secondary_process::election_mode
private

The election invocation context.

◆ election_process_aborted

bool Primary_election_secondary_process::election_process_aborted
private

Is the process aborted.

◆ election_process_thd_state

thread_state Primary_election_secondary_process::election_process_thd_state
private

The election thread status.

◆ group_in_read_mode

bool Primary_election_secondary_process::group_in_read_mode
private

Are all group members in read mode.

◆ is_waiting_on_read_mode_group

bool Primary_election_secondary_process::is_waiting_on_read_mode_group
private

Process is waiting on read mode - stage related var.

◆ known_members_addresses

std::list<std::string> Primary_election_secondary_process::known_members_addresses
private

The members known for the current action.

◆ number_of_know_members

ulong Primary_election_secondary_process::number_of_know_members
private

The number of known members when the election started.

◆ primary_election_pthd

my_thread_handle Primary_election_secondary_process::primary_election_pthd
private

The thread handle.

◆ primary_ready

bool Primary_election_secondary_process::primary_ready
private

◆ primary_uuid

std::string Primary_election_secondary_process::primary_uuid
private

The primary to be elected.

◆ stage_handler

Plugin_stage_monitor_handler* Primary_election_secondary_process::stage_handler
private

The stage handler for progress reporting.

◆ stop_wait_timeout

ulong Primary_election_secondary_process::stop_wait_timeout
private

◆ waiting_on_old_primary_transactions

bool Primary_election_secondary_process::waiting_on_old_primary_transactions
private

Waiting for old primary transaction execution.


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