MySQL  8.0.20
Source Code Documentation
pipeline_handlers.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2020, 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  */
114  Handler_applier_configuration_action(char *applier_name, bool reset_logs,
115  ulong plugin_shutdown_timeout,
116  rpl_sidno group_sidno)
118  applier_name(applier_name),
119  reset_logs(reset_logs),
120  applier_shutdown_timeout(plugin_shutdown_timeout),
121  group_sidno(group_sidno),
122  initialization_conf(true) {
123  DBUG_ASSERT(applier_name != nullptr);
124  }
125 
126  /**
127  Configuration for applier handlers
128 
129  @param plugin_shutdown_timeout the plugin's timeout for component shutdown
130  */
131  Handler_applier_configuration_action(ulong plugin_shutdown_timeout)
133  applier_name(nullptr),
134  reset_logs(false),
135  applier_shutdown_timeout(plugin_shutdown_timeout),
136  group_sidno(0),
137  initialization_conf(false) {}
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 
148  ulong get_applier_shutdown_timeout() { return applier_shutdown_timeout; }
149 
150  bool is_reset_logs_planned() { return reset_logs; }
151 
152  rpl_sidno get_sidno() { return group_sidno; }
153 
154  /**
155  Informs if this is a action with configurations for initialization or just
156  timeout configurations.
157 
158  @retval true if initialization action
159  @retval false if timeout configuration action
160  */
161  bool is_initialization_conf() { return initialization_conf; }
162 
163  private:
164  /*The applier's name, used for channel naming*/
166  /*If a reset was executed in the server */
168  /*The plugin's timeout for component shutdown set in the applier*/
170  /*The configured group sidno*/
172 
173  // Internal fields
174 
175  /*If this is a initialization packet or not*/
177 };
178 
179 /**
180  @class Handler_certifier_configuration_action
181 
182  Action to configure existing certification handlers
183 */
185  public:
186  /**
187  Configuration for certification handlers
188 
189  @param group_sidno the group sidno
190  @param gtid_assignment_block_size the group gtid assignment block size
191  */
193  ulonglong gtid_assignment_block_size)
195  group_sidno(group_sidno),
196  gtid_assignment_block_size(gtid_assignment_block_size) {}
197 
198  rpl_sidno get_group_sidno() { return group_sidno; }
199 
201  return gtid_assignment_block_size;
202  }
203 
204  private:
207 };
208 
209 /**
210  @class Handler_certifier_information_action
211 
212  Action that carries a certification info to be
213  applied on certification handlers.
214 */
216  public:
217  /**
218  Create an action to communicate certification info to a certifier
219 
220  @param cert_info A certification info
221  */
223  std::map<std::string, std::string> *cert_info)
225  certification_info(cert_info) {}
226 
227  std::map<std::string, std::string> *get_certification_info() {
228  return certification_info;
229  }
230 
231  private:
232  std::map<std::string, std::string> *certification_info;
233 };
234 
235 /**
236  @class View_change_pipeline_action
237 
238  Action to signal any interested handler that a VC happened
239 */
241  public:
242  /**
243  Creates an action to inform handler of a View Change
244 
245  @param is_leaving informs if the member is leaving
246  */
248  : Pipeline_action(HANDLER_VIEW_CHANGE_ACTION), leaving(is_leaving) {}
249 
250  bool is_leaving() { return leaving; }
251 
252  private:
253  /*If this member is leaving the group on this view change*/
254  bool leaving;
255 };
256 
257 /**
258  @class Handler_THD_setup_action
259 
260  Action that gives handlers access to the a THD object.
261  This THD would usually belong to the caller avoiding the current_thd macro
262 */
264  public:
265  /**
266  An action that a THD object
267 
268  @param given_thread a pointer to a THD object
269  */
271  : Pipeline_action(HANDLER_THD_ACTION), shared_thd_object(given_thread) {}
272 
273  THD *get_THD_object() { return shared_thd_object; }
274 
275  private:
277 };
278 
279 #endif /* PIPELINE_HANDLERS_INCLUDED */
Definition: pipeline_handlers.h:71
unsigned long long int ulonglong
Definition: my_inttypes.h:55
int rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:95
~Handler_stop_action()
Definition: pipeline_handlers.h:96
char * applier_name
Definition: pipeline_handlers.h:165
Definition: pipeline_handlers.h:52
Definition: pipeline_handlers.h:51
bool reset_logs
Definition: pipeline_handlers.h:167
ulonglong get_gtid_assignment_block_size()
Definition: pipeline_handlers.h:200
transaction end event
Definition: pipeline_handlers.h:40
A wrapper for pipeline actions.
Definition: pipeline_interfaces.h:500
View_change_pipeline_action(bool is_leaving)
Creates an action to inform handler of a View Change.
Definition: pipeline_handlers.h:247
~Handler_applier_configuration_action()
Definition: pipeline_handlers.h:139
Action that gives handlers access to the a THD object.
Definition: pipeline_handlers.h:263
Action to configure existing applier handlers.
Definition: pipeline_handlers.h:104
enum enum_group_replication_handler_actions Plugin_handler_action
char * get_applier_name()
Definition: pipeline_handlers.h:146
enum_group_replication_handler_actions
Enumeration of all actions sent to the plugin handlers.
Definition: pipeline_handlers.h:63
Action to signal any interested handler that a VC happened.
Definition: pipeline_handlers.h:240
Definition: pipeline_handlers.h:69
Handler_certifier_configuration_action(rpl_sidno group_sidno, ulonglong gtid_assignment_block_size)
Configuration for certification handlers.
Definition: pipeline_handlers.h:192
enum_event_modifier
Definition: pipeline_handlers.h:38
bool leaving
Definition: pipeline_handlers.h:254
Definition: pipeline_handlers.h:72
Definition: pipeline_handlers.h:64
rpl_sidno group_sidno
Definition: pipeline_handlers.h:171
std::map< std::string, std::string > * certification_info
Definition: pipeline_handlers.h:232
enum_handler_role
Enumeration type for the different roles of the used handlers.
Definition: pipeline_handlers.h:50
Definition: pipeline_handlers.h:55
transaction start event
Definition: pipeline_handlers.h:39
Handler_applier_configuration_action(ulong plugin_shutdown_timeout)
Configuration for applier handlers.
Definition: pipeline_handlers.h:131
Handler_start_action()
Definition: pipeline_handlers.h:82
THD * get_THD_object()
Definition: pipeline_handlers.h:273
#define DBUG_ASSERT(A)
Definition: my_dbug.h:199
Definition: pipeline_handlers.h:66
bool initialization_conf
Definition: pipeline_handlers.h:176
ulonglong gtid_assignment_block_size
Definition: pipeline_handlers.h:206
bool is_leaving()
Definition: pipeline_handlers.h:250
THD * shared_thd_object
Definition: pipeline_handlers.h:276
Action to configure existing certification handlers.
Definition: pipeline_handlers.h:184
bool is_initialization_conf()
Informs if this is a action with configurations for initialization or just timeout configurations...
Definition: pipeline_handlers.h:161
std::map< std::string, std::string > * get_certification_info()
Definition: pipeline_handlers.h:227
#define true
Definition: config_static.h:44
Action to signal the handler to stop existing routines.
Definition: pipeline_handlers.h:92
Handler_stop_action()
Definition: pipeline_handlers.h:94
Definition: pipeline_handlers.h:67
Handler_THD_setup_action(THD *given_thread)
An action that a THD object.
Definition: pipeline_handlers.h:270
rpl_sidno get_sidno()
Definition: pipeline_handlers.h:152
ulong applier_shutdown_timeout
Definition: pipeline_handlers.h:169
the current Pipeline_event only contains a single view event injected from GCS
Definition: pipeline_handlers.h:42
ulong get_applier_shutdown_timeout()
Definition: pipeline_handlers.h:148
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:222
rpl_sidno group_sidno
Definition: pipeline_handlers.h:205
Definition: pipeline_handlers.h:65
Definition: pipeline_handlers.h:53
Definition: pipeline_handlers.h:54
Action to signal the handler to start existing routines.
Definition: pipeline_handlers.h:80
rpl_sidno get_group_sidno()
Definition: pipeline_handlers.h:198
~Handler_start_action()
Definition: pipeline_handlers.h:84
bool is_reset_logs_planned()
Definition: pipeline_handlers.h:150
Definition: pipeline_handlers.h:68
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
transaction regular event
Definition: pipeline_handlers.h:41
Action that carries a certification info to be applied on certification handlers. ...
Definition: pipeline_handlers.h:215
#define false
Definition: config_static.h:43
Definition: pipeline_handlers.h:70
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:765
Dialog Client Authentication nullptr
Definition: dialog.cc:353