24#ifndef PRIMARY_ELECTION_INCLUDED
25#define PRIMARY_ELECTION_INCLUDED
76 int32 transaction_wait_timeout = -1);
92 const std::string &message_origin)
override;
141 std::string &error_message);
146 const std::vector<Gcs_member_identifier> &leaving,
147 const std::vector<Gcs_member_identifier> &group,
148 bool is_leaving,
bool *skip_election,
150 std::string &suggested_primary)
override;
152 std::string primary_uuid,
156 const std::string &message_origin,
157 bool *skip_message)
override;
The parent class for group wide operations.
Definition: group_action.h:35
Definition: group_action_message.h:33
The parent class for group wide operations.
Definition: group_action.h:139
enum_action_execution_result
Enum for the end results of a action execution.
Definition: group_action.h:142
Class that others can extend to receive notifications about views and primary elections.
Definition: group_event_observer.h:40
A convenience context class used to share information between the event handlers and the notifier.
Definition: notification.h:35
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:64
Definition: stage_monitor_handler.h:30
The group action class to do migration to primary mode or elect a primary.
Definition: primary_election_action.h:37
void get_action_message(Group_action_message **message) override
Get the message with parameters to this action.
Definition: primary_election_action.cc:99
bool action_killed
Was this action order to terminate by a kill signal.
Definition: primary_election_action.h:185
int32 m_transaction_wait_timeout
The number of seconds to wait before setting the THD::KILL_CONNECTION flag for the transactions that ...
Definition: primary_election_action.h:223
Primary_election_action()
Create a new primary election action.
Definition: primary_election_action.cc:32
int before_message_handling(const Plugin_gcs_message &message, const std::string &message_origin, bool *skip_message) override
Executed before the message is processed.
Definition: primary_election_action.cc:700
~Primary_election_action() override
Definition: primary_election_action.cc:71
bool is_primary_election_invoked
Is the primary election invoked.
Definition: primary_election_action.h:201
Transaction_monitor_thread * transaction_monitor_thread
Used to monitor transactions, this stops the new transactions and sets the THD::KILL_CONNECTION flag ...
Definition: primary_election_action.h:229
std::string appointed_primary_uuid
The primary to elect.
Definition: primary_election_action.h:188
std::string invoking_member_gcs_id
The id of the invoking primary.
Definition: primary_election_action.h:192
enum_primary_election_phase current_action_phase
The current phase.
Definition: primary_election_action.h:177
bool stop_action_execution(bool killed) override
Definition: primary_election_action.cc:429
enum_primary_election_status
Enum for the phases on the primary action.
Definition: primary_election_action.h:56
@ PRIMARY_ELECTION_END_ELECTION
Definition: primary_election_action.h:58
@ PRIMARY_ELECTION_END_ERROR
Definition: primary_election_action.h:59
@ PRIMARY_ELECTION_INIT
Definition: primary_election_action.h:57
mysql_mutex_t notification_lock
The lock for notifications.
Definition: primary_election_action.h:208
std::string old_primary_uuid
The uuid of the original master at action invocation.
Definition: primary_election_action.h:194
mysql_mutex_t phase_lock
Lock for the phase change.
Definition: primary_election_action.h:179
Primary_election_validation_handler validation_handler
The handler for primary election validations.
Definition: primary_election_action.h:213
Group_action_diagnostics * get_execution_info() override
Gets the info about execution, be it success or failure.
Definition: primary_election_action.cc:460
my_thread_id invoking_thread_id
The thread that invoked this action - if applicable, 0 otherwise.
Definition: primary_election_action.h:198
void change_action_phase(enum_primary_election_phase phase)
Changes the phase where the action is currently.
Definition: primary_election_action.cc:444
bool stop_transaction_monitor_thread()
Stop the transaction_monitor_thread if running.
Definition: primary_election_action.cc:89
enum_action_execution_mode
Enum for type of primary election executed.
Definition: primary_election_action.h:40
@ PRIMARY_ELECTION_ACTION_END
Definition: primary_election_action.h:43
@ PRIMARY_ELECTION_ACTION_PRIMARY_SWITCH
Definition: primary_election_action.h:41
@ PRIMARY_ELECTION_ACTION_MODE_SWITCH
Definition: primary_election_action.h:42
bool error_on_primary_election
Was there an error in the election.
Definition: primary_election_action.h:183
mysql_cond_t notification_cond
The condition for notifications.
Definition: primary_election_action.h:210
Group_action::enum_action_execution_result execute_action(bool invoking_member, Plugin_stage_monitor_handler *stage_handler, Notification_context *) override
Execute the action.
Definition: primary_election_action.cc:232
std::string appointed_primary_gcs_id
The id of the primary to elect.
Definition: primary_election_action.h:190
enum_primary_election_status m_execution_status
primary election status
Definition: primary_election_action.h:203
void log_result_execution(bool error, bool aborted, bool mode_changed, std::string &error_message)
Log the result of the execution.
Definition: primary_election_action.cc:760
bool is_transaction_queue_applied
Is the transaction back log consumed.
Definition: primary_election_action.h:205
bool single_election_action_aborted
Is this action aborted.
Definition: primary_election_action.h:181
enum_action_execution_mode action_execution_mode
Is this an primary change or mode change.
Definition: primary_election_action.h:169
int process_action_message(Group_action_message &message, const std::string &message_origin) override
Definition: primary_election_action.cc:105
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.
Definition: primary_election_action.cc:655
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.
Definition: primary_election_action.cc:466
bool persist_variable_values()
Persist the value of the variables changed in the action.
Definition: primary_election_action.cc:733
bool is_primary
If this member is old primary.
Definition: primary_election_action.h:196
enum_primary_election_phase
Enum for the phases on the primary action.
Definition: primary_election_action.h:47
@ PRIMARY_NO_PHASE
Definition: primary_election_action.h:48
@ PRIMARY_ELECTION_PHASE
Definition: primary_election_action.h:51
@ PRIMARY_ELECTED_PHASE
Definition: primary_election_action.h:52
@ PRIMARY_VALIDATION_PHASE
Definition: primary_election_action.h:49
@ PRIMARY_SAFETY_CHECK_PHASE
Definition: primary_election_action.h:50
PSI_stage_key get_action_stage_termination_key() override
For this action, what is the PSI key for the last stage when the action is terminating.
Definition: primary_election_action.cc:452
Group_action_diagnostics execution_message_area
Place to store result messages.
Definition: primary_election_action.h:216
Definition: primary_election_validation_handler.h:32
Class for creating a new thread that allows to stop the new transactions allowing some management que...
Definition: group_actions_transaction_controller.h:38
unsigned int PSI_stage_key
Instrumented stage key.
Definition: psi_stage_bits.h:43
int32_t int32
Definition: my_inttypes.h:66
static my_thread_id thread_id
Definition: my_thr_init.cc:63
uint32 my_thread_id
Definition: my_thread_local.h:34
enum_primary_election_mode
Enum for election types.
Definition: primary_election_include.h:33
enum_primary_election_primary_change_status
Enum for primary change status.
Definition: primary_election_include.h:50
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50