MySQL 8.0.39
Source Code Documentation
multi_primary_migration_action.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MULTI_PRIMARY_MIGRATION_INCLUDED
25#define MULTI_PRIMARY_MIGRATION_INCLUDED
26
31
32/**
33 @class Multi_primary_migration_action
34 The group action class to do migration to multi primary mode
35*/
38 public:
39 /**
40 Create a new primary election action
41 */
43
44 /**
45 Create a new primary election action
46
47 @param invoking_thread_id the local thread id that is invoking this action
48 */
50
52
53 /*
54 Get the message with parameters to this action
55 @param message [out] the message to start the action
56 */
57 void get_action_message(Group_action_message **message) override;
58
59 /*
60 Get the message with parameters to this action
61 @param message the message to start the action
62 @param message_origin the invoker address
63*/
65 const std::string &message_origin) override;
66
67 /**
68 Execute the action
69 @param invoking_member is the member that invoked it
70 @param stage_handler the stage handler to report progress
71 @param ctx the notification context
72
73 @returns the execution result
74 */
76 bool invoking_member, Plugin_stage_monitor_handler *stage_handler,
77 Notification_context *ctx) override;
78
79 /*
80 Terminate the executing configuration operation
81 @param killed are we killing the action.
82
83 @return true if a problem was found when stopping the action.
84 */
85 bool stop_action_execution(bool killed) override;
86
87 /**
88 Gets the info about execution, be it success or failure
89 @return the execution diagnostics object that was the message and its level
90 */
92
93 /**
94 For this action, what is the PSI key for the last stage when the action is
95 terminating.
96 @return The stage key for this class
97 */
99
100 private:
101 /**
102 Persist the value of the variables changed in the action
103 @return true if a problem was found, false otherwise
104 */
106
107 /**
108 Log the result of the execution
109 @param aborted was the action aborted?
110 @param mode_changed was the mode changed to multi primary?
111 */
112 void log_result_execution(bool aborted, bool mode_changed);
113
114 // The listeners for group events
115
116 int after_view_change(const std::vector<Gcs_member_identifier> &joining,
117 const std::vector<Gcs_member_identifier> &leaving,
118 const std::vector<Gcs_member_identifier> &group,
119 bool is_leaving, bool *skip_election,
120 enum_primary_election_mode *election_mode,
121 std::string &suggested_primary) override;
123 std::string primary_uuid,
125 enum_primary_election_mode election_mode, int error) override;
127 const std::string &message_origin,
128 bool *skip_message) override;
129
130 /** The thread that invoked this action - if applicable, 0 otherwise */
132
133 /** Is the process aborted */
135 /** Was this action order to terminate by a kill signal*/
137
138 /** The current primary*/
139 std::string primary_uuid;
140 /** The id of the primary*/
141 std::string primary_gcs_id;
142 /** If the member is primary*/
144 /** Is the primary transaction back log consumed*/
146
147 /** Continuation object to wait on the applier queue consumption*/
148 std::shared_ptr<Continuation> applier_checkpoint_condition;
149
150 /**The lock for notifications*/
152 /**The condition for notifications*/
154
155 /**Place to store result messages*/
157};
158
159#endif /* MULTI_PRIMARY_MIGRATION_INCLUDED */
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
The group action class to do migration to multi primary mode.
Definition: multi_primary_migration_action.h:37
void log_result_execution(bool aborted, bool mode_changed)
Log the result of the execution.
Definition: multi_primary_migration_action.cc:370
int process_action_message(Group_action_message &message, const std::string &message_origin) override
Definition: multi_primary_migration_action.cc:71
bool is_primary_transaction_queue_applied
Is the primary transaction back log consumed.
Definition: multi_primary_migration_action.h:145
my_thread_id invoking_thread_id
The thread that invoked this action - if applicable, 0 otherwise.
Definition: multi_primary_migration_action.h:131
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: multi_primary_migration_action.cc:312
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: multi_primary_migration_action.cc:318
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: multi_primary_migration_action.cc:284
std::shared_ptr< Continuation > applier_checkpoint_condition
Continuation object to wait on the applier queue consumption.
Definition: multi_primary_migration_action.h:148
~Multi_primary_migration_action() override
Definition: multi_primary_migration_action.cc:60
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: multi_primary_migration_action.cc:280
Group_action::enum_action_execution_result execute_action(bool invoking_member, Plugin_stage_monitor_handler *stage_handler, Notification_context *ctx) override
Execute the action.
Definition: multi_primary_migration_action.cc:100
bool action_killed
Was this action order to terminate by a kill signal.
Definition: multi_primary_migration_action.h:136
mysql_mutex_t notification_lock
The lock for notifications.
Definition: multi_primary_migration_action.h:151
Group_action_diagnostics execution_message_area
Place to store result messages.
Definition: multi_primary_migration_action.h:156
Group_action_diagnostics * get_execution_info() override
Gets the info about execution, be it success or failure.
Definition: multi_primary_migration_action.cc:275
bool multi_primary_switch_aborted
Is the process aborted.
Definition: multi_primary_migration_action.h:134
Multi_primary_migration_action()
Create a new primary election action.
Definition: multi_primary_migration_action.cc:41
bool persist_variable_values()
Persist the value of the variables changed in the action.
Definition: multi_primary_migration_action.cc:343
std::string primary_uuid
The current primary.
Definition: multi_primary_migration_action.h:139
bool is_primary
If the member is primary.
Definition: multi_primary_migration_action.h:143
void get_action_message(Group_action_message **message) override
Get the message with parameters to this action.
Definition: multi_primary_migration_action.cc:65
mysql_cond_t notification_cond
The condition for notifications.
Definition: multi_primary_migration_action.h:153
std::string primary_gcs_id
The id of the primary.
Definition: multi_primary_migration_action.h:141
bool stop_action_execution(bool killed) override
Definition: multi_primary_migration_action.cc:264
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
unsigned int PSI_stage_key
Instrumented stage key.
Definition: psi_stage_bits.h:43
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