MySQL  8.0.19
Source Code Documentation
pipeline_handlers.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
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 also distributed 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 included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef PIPELINE_HANDLERS_INCLUDED
24 #define PIPELINE_HANDLERS_INCLUDED
25 
27 
28 #include "my_dbug.h"
33 
34 /*
35  @enum Event modifier
36  Enumeration type for the different kinds of pipeline event modifiers.
37 */
39  TRANSACTION_BEGIN = 1, ///< transaction start event
40  TRANSACTION_END = 2, ///< transaction end event
41  UNMARKED_EVENT = 3, ///< transaction regular event
42  SINGLE_VIEW_EVENT = 4, ///< the current Pipeline_event only contains
43  ///< a single view event injected from GCS
44 };
45 
46 /**
47  @enum enum_handler_role
48  Enumeration type for the different roles of the used handlers.
49 */
52  APPLIER = 1,
53  CERTIFIER = 2,
54  QUEUER = 3,
55  ROLE_NUMBER = 4 // The number of roles
56 };
57 
58 /**
59  @enum enum_group_replication_handler_actions
60 
61  Enumeration of all actions sent to the plugin handlers.
62 */
64  HANDLER_START_ACTION = 0, // Action that signals the handlers to start
65  HANDLER_STOP_ACTION = 1, // Action that signals the handlers to stop
66  HANDLER_APPLIER_CONF_ACTION = 2, // Configuration for applier handlers
67  HANDLER_CERT_CONF_ACTION = 3, // Configuration for certification handlers
68  HANDLER_CERT_INFO_ACTION = 4, // Certification info for the certifier
69  HANDLER_VIEW_CHANGE_ACTION = 5, // Certification notification on view change
70  HANDLER_GCS_INTERFACE_ACTION = 6, // Action with GCS interfaces to be used.
71  HANDLER_THD_ACTION = 7, // Configuration action that carries a THD obj
72  HANDLER_ACTION_NUMBER = 8 // The number of roles
74 
75 /**
76  @class Handler_start_action
77 
78  Action to signal the handler to start existing routines
79 */
81  public:
83 
85 };
86 
87 /**
88  @class Handler_stop_action
89 
90  Action to signal the handler to stop existing routines
91 */
93  public:
95 
97 };
98 
99 /**
100  @class Handler_applier_configuration_action
101 
102  Action to configure existing applier handlers
103 */
105  public:
106  /**
107  Configuration for applier handlers
108 
109  @param applier_name the applier's channel name
110  @param reset_logs if a reset was executed in the server
111  @param plugin_shutdown_timeout the plugin's timeout for component shutdown
112  @param group_sidno the group configured sidno
113  */
115  ulong plugin_shutdown_timeout,
120  applier_shutdown_timeout(plugin_shutdown_timeout),
124  }
125 
126  /**
127  Configuration for applier handlers
128 
129  @param plugin_shutdown_timeout the plugin's timeout for component shutdown
130  */
134  reset_logs(false),
135  applier_shutdown_timeout(plugin_shutdown_timeout),
136  group_sidno(0),
138 
140 
141  /**
142  @return the applier's name
143  @retval NULL if not defined
144  @retval !=NULL if defined
145  */
146  char *get_applier_name() { return applier_name; }
147 
149 
151 
153 
154  /**
155  Informs if this is a action with configurations for initialization or just
156  timeout configurations.
157 
158  @return
159  @retval true if initialization action
160  @retval false if timeout configuration action
161  */
163 
164  private:
165  /*The applier's name, used for channel naming*/
167  /*If a reset was executed in the server */
169  /*The plugin's timeout for component shutdown set in the applier*/
171  /*The configured group sidno*/
173 
174  // Internal fields
175 
176  /*If this is a initialization packet or not*/
178 };
179 
180 /**
181  @class Handler_certifier_configuration_action
182 
183  Action to configure existing certification handlers
184 */
186  public:
187  /**
188  Configuration for certification handlers
189 
190  @param group_sidno the group sidno
191  @param gtid_assignment_block_size the group gtid assignment block size
192  */
198 
200 
203  }
204 
205  private:
208 };
209 
210 /**
211  @class Handler_certifier_information_action
212 
213  Action that carries a certification info to be
214  applied on certification handlers.
215 */
217  public:
218  /**
219  Create an action to communicate certification info to a certifier
220 
221  @param cert_info A certification info
222  */
224  std::map<std::string, std::string> *cert_info)
226  certification_info(cert_info) {}
227 
228  std::map<std::string, std::string> *get_certification_info() {
229  return certification_info;
230  }
231 
232  private:
233  std::map<std::string, std::string> *certification_info;
234 };
235 
236 /**
237  @class View_change_pipeline_action
238 
239  Action to signal any interested handler that a VC happened
240 */
242  public:
243  /**
244  Creates an action to inform handler of a View Change
245 
246  @param is_leaving informs if the member is leaving
247  */
250 
251  bool is_leaving() { return leaving; }
252 
253  private:
254  /*If this member is leaving the group on this view change*/
255  bool leaving;
256 };
257 
258 /**
259  @class Handler_THD_setup_action
260 
261  Action that gives handlers access to the a THD object.
262  This THD would usually belong to the caller avoiding the current_thd macro
263 */
265  public:
266  /**
267  An action that a THD object
268 
269  @param given_thread a pointer to a THD object
270  */
273 
275 
276  private:
278 };
279 
280 #endif /* PIPELINE_HANDLERS_INCLUDED */
Handler_certifier_information_action::certification_info
std::map< std::string, std::string > * certification_info
Definition: pipeline_handlers.h:233
Handler_applier_configuration_action::applier_name
char * applier_name
Definition: pipeline_handlers.h:166
THD
Definition: sql_class.h:764
Handler_applier_configuration_action::Handler_applier_configuration_action
Handler_applier_configuration_action(char *applier_name, bool reset_logs, ulong plugin_shutdown_timeout, rpl_sidno group_sidno)
Configuration for applier handlers.
Definition: pipeline_handlers.h:114
pipeline_interfaces.h
Handler_applier_configuration_action
Definition: pipeline_handlers.h:104
Handler_applier_configuration_action::initialization_conf
bool initialization_conf
Definition: pipeline_handlers.h:177
Handler_stop_action::Handler_stop_action
Handler_stop_action()
Definition: pipeline_handlers.h:94
QUEUER
@ QUEUER
Definition: pipeline_handlers.h:54
UNMARKED_EVENT
@ UNMARKED_EVENT
transaction regular event
Definition: pipeline_handlers.h:41
Handler_THD_setup_action
Definition: pipeline_handlers.h:264
NULL
#define NULL
Definition: types.h:55
Handler_certifier_information_action
Definition: pipeline_handlers.h:216
Handler_certifier_configuration_action::Handler_certifier_configuration_action
Handler_certifier_configuration_action(rpl_sidno group_sidno, ulonglong gtid_assignment_block_size)
Configuration for certification handlers.
Definition: pipeline_handlers.h:193
APPLIER
@ APPLIER
Definition: pipeline_handlers.h:52
View_change_pipeline_action::is_leaving
bool is_leaving()
Definition: pipeline_handlers.h:251
HANDLER_STOP_ACTION
@ HANDLER_STOP_ACTION
Definition: pipeline_handlers.h:65
HANDLER_THD_ACTION
@ HANDLER_THD_ACTION
Definition: pipeline_handlers.h:71
TRANSACTION_END
@ TRANSACTION_END
transaction end event
Definition: pipeline_handlers.h:40
my_dbug.h
ROLE_NUMBER
@ ROLE_NUMBER
Definition: pipeline_handlers.h:55
HANDLER_GCS_INTERFACE_ACTION
@ HANDLER_GCS_INTERFACE_ACTION
Definition: pipeline_handlers.h:70
HANDLER_CERT_CONF_ACTION
@ HANDLER_CERT_CONF_ACTION
Definition: pipeline_handlers.h:67
rpl_sidno
int rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:94
SINGLE_VIEW_EVENT
@ SINGLE_VIEW_EVENT
the current Pipeline_event only contains a single view event injected from GCS
Definition: pipeline_handlers.h:42
EVENT_CATALOGER
@ EVENT_CATALOGER
Definition: pipeline_handlers.h:51
HANDLER_START_ACTION
@ HANDLER_START_ACTION
Definition: pipeline_handlers.h:64
true
#define true
Definition: config_static.h:44
Handler_start_action
Definition: pipeline_handlers.h:80
Handler_applier_configuration_action::group_sidno
rpl_sidno group_sidno
Definition: pipeline_handlers.h:172
Handler_THD_setup_action::shared_thd_object
THD * shared_thd_object
Definition: pipeline_handlers.h:277
gcs_communication_interface.h
enum_event_modifier
enum_event_modifier
Definition: pipeline_handlers.h:38
Handler_applier_configuration_action::get_applier_shutdown_timeout
ulong get_applier_shutdown_timeout()
Definition: pipeline_handlers.h:148
Handler_start_action::Handler_start_action
Handler_start_action()
Definition: pipeline_handlers.h:82
Handler_applier_configuration_action::is_initialization_conf
bool is_initialization_conf()
Informs if this is a action with configurations for initialization or just timeout configurations.
Definition: pipeline_handlers.h:162
enum_handler_role
enum_handler_role
Definition: pipeline_handlers.h:50
enum_group_replication_handler_actions
enum_group_replication_handler_actions
Definition: pipeline_handlers.h:63
Handler_THD_setup_action::Handler_THD_setup_action
Handler_THD_setup_action(THD *given_thread)
An action that a THD object.
Definition: pipeline_handlers.h:271
View_change_pipeline_action
Definition: pipeline_handlers.h:241
HANDLER_APPLIER_CONF_ACTION
@ HANDLER_APPLIER_CONF_ACTION
Definition: pipeline_handlers.h:66
Handler_certifier_configuration_action::gtid_assignment_block_size
ulonglong gtid_assignment_block_size
Definition: pipeline_handlers.h:207
Handler_stop_action
Definition: pipeline_handlers.h:92
HANDLER_VIEW_CHANGE_ACTION
@ HANDLER_VIEW_CHANGE_ACTION
Definition: pipeline_handlers.h:69
HANDLER_CERT_INFO_ACTION
@ HANDLER_CERT_INFO_ACTION
Definition: pipeline_handlers.h:68
HANDLER_ACTION_NUMBER
@ HANDLER_ACTION_NUMBER
Definition: pipeline_handlers.h:72
Pipeline_action
Definition: pipeline_interfaces.h:502
Handler_applier_configuration_action::~Handler_applier_configuration_action
~Handler_applier_configuration_action()
Definition: pipeline_handlers.h:139
Plugin_handler_action
enum enum_group_replication_handler_actions Plugin_handler_action
Handler_certifier_configuration_action
Definition: pipeline_handlers.h:185
Handler_certifier_configuration_action::get_group_sidno
rpl_sidno get_group_sidno()
Definition: pipeline_handlers.h:199
DBUG_ASSERT
#define DBUG_ASSERT(A)
Definition: my_dbug.h:197
View_change_pipeline_action::View_change_pipeline_action
View_change_pipeline_action(bool is_leaving)
Creates an action to inform handler of a View Change.
Definition: pipeline_handlers.h:248
Handler_applier_configuration_action::reset_logs
bool reset_logs
Definition: pipeline_handlers.h:168
TRANSACTION_BEGIN
@ TRANSACTION_BEGIN
transaction start event
Definition: pipeline_handlers.h:39
CERTIFIER
@ CERTIFIER
Definition: pipeline_handlers.h:53
Handler_applier_configuration_action::get_applier_name
char * get_applier_name()
Definition: pipeline_handlers.h:146
Handler_certifier_information_action::get_certification_info
std::map< std::string, std::string > * get_certification_info()
Definition: pipeline_handlers.h:228
gcs_control_interface.h
Handler_start_action::~Handler_start_action
~Handler_start_action()
Definition: pipeline_handlers.h:84
Handler_applier_configuration_action::is_reset_logs_planned
bool is_reset_logs_planned()
Definition: pipeline_handlers.h:150
Handler_certifier_configuration_action::group_sidno
rpl_sidno group_sidno
Definition: pipeline_handlers.h:206
ulong
unsigned long ulong
Definition: my_inttypes.h:48
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
member_info.h
Handler_applier_configuration_action::get_sidno
rpl_sidno get_sidno()
Definition: pipeline_handlers.h:152
Handler_applier_configuration_action::Handler_applier_configuration_action
Handler_applier_configuration_action(ulong plugin_shutdown_timeout)
Configuration for applier handlers.
Definition: pipeline_handlers.h:131
Handler_THD_setup_action::get_THD_object
THD * get_THD_object()
Definition: pipeline_handlers.h:274
View_change_pipeline_action::leaving
bool leaving
Definition: pipeline_handlers.h:255
Handler_applier_configuration_action::applier_shutdown_timeout
ulong applier_shutdown_timeout
Definition: pipeline_handlers.h:170
Handler_certifier_information_action::Handler_certifier_information_action
Handler_certifier_information_action(std::map< std::string, std::string > *cert_info)
Create an action to communicate certification info to a certifier.
Definition: pipeline_handlers.h:223
Handler_certifier_configuration_action::get_gtid_assignment_block_size
ulonglong get_gtid_assignment_block_size()
Definition: pipeline_handlers.h:201
Handler_stop_action::~Handler_stop_action
~Handler_stop_action()
Definition: pipeline_handlers.h:96
group_replication_priv.h
false
#define false
Definition: config_static.h:43