MySQL  8.0.20
Source Code Documentation
pipeline_interfaces.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_INTERFACES_INCLUDED
24 #define PIPELINE_INTERFACES_INCLUDED
25 
26 #include <list>
27 
31 
32 #include "mysqld_error.h"
36 
37 // Define the data packet type
38 #define DATA_PACKET_TYPE 1
39 
40 /**
41  @class Packet
42 
43  A generic interface for different kinds of packets.
44 */
45 class Packet {
46  public:
47  /**
48  Create a new generic packet of a certain type.
49 
50  @param[in] type the packet type
51  */
52  Packet(int type) : packet_type(type) {}
53 
54  virtual ~Packet() {}
55 
56  /**
57  @return the packet type
58  */
59  int get_packet_type() { return packet_type; }
60 
61  private:
63 };
64 
65 /**
66  @class Data_packet
67 
68  A wrapper for raw network packets.
69 */
70 class Data_packet : public Packet {
71  public:
72  /**
73  Create a new data packet wrapper.
74 
75  @param[in] data the packet data
76  @param[in] len the packet length
77  @param[in] consistency_level the transaction consistency level
78  @param[in] online_members the ONLINE members when the transaction
79  message was delivered
80  */
81  Data_packet(const uchar *data, ulong len,
84  std::list<Gcs_member_identifier> *online_members = nullptr)
86  payload(nullptr),
87  len(len),
88  m_consistency_level(consistency_level),
89  m_online_members(online_members) {
90  payload = (uchar *)my_malloc(PSI_NOT_INSTRUMENTED, len, MYF(0));
91  memcpy(payload, data, len);
92  }
93 
95  my_free(payload);
96  delete m_online_members;
97  }
98 
100  ulong len;
102  std::list<Gcs_member_identifier> *m_online_members;
103 };
104 
105 // Define the data packet type
106 #define UNDEFINED_EVENT_MODIFIER 0
107 
108 // Define the size of the pipeline event buffer
109 #define DEFAULT_EVENT_BUFFER_SIZE 16384
110 
111 /**
112  @class Pipeline_event
113 
114  A wrapper for log events/packets. This class allows for the marking of events
115  and its transformation between the packet and log event formats as requested
116  in the interface.
117 
118  @note Events can be marked as with event modifiers.
119  This is a generic field allowing modifiers to vary with use context.
120  If not specified, this field has a default value of 0.
121 */
123  public:
124  /**
125  Create a new pipeline wrapper based on a packet.
126 
127  @note If a modifier is not provided the event will be marked as `UNDEFINED`
128 
129  @param[in] base_packet the wrapper packet
130  @param[in] fde_event the format description event for conversions
131  @param[in] modifier the event modifier
132  @param[in] consistency_level the transaction consistency level
133  @param[in] online_members the ONLINE members when the transaction
134  message was delivered
135  */
137  Format_description_log_event *fde_event,
138  int modifier = UNDEFINED_EVENT_MODIFIER,
139  enum_group_replication_consistency_level consistency_level =
141  std::list<Gcs_member_identifier> *online_members = nullptr)
142  : packet(base_packet),
143  log_event(nullptr),
144  event_context(modifier),
145  format_descriptor(fde_event),
146  m_consistency_level(consistency_level),
147  m_online_members(online_members),
148  m_online_members_memory_ownership(true) {}
149 
150  /**
151  Create a new pipeline wrapper based on a log event.
152 
153  @note If a modifier is not provided the event will be marked as `UNDEFINED`
154 
155  @param[in] base_event the wrapper log event
156  @param[in] fde_event the format description event for conversions
157  @param[in] modifier the event modifier
158  @param[in] consistency_level the transaction consistency level
159  @param[in] online_members the ONLINE members when the transaction
160  message was delivered
161  */
163  int modifier = UNDEFINED_EVENT_MODIFIER,
164  enum_group_replication_consistency_level consistency_level =
166  std::list<Gcs_member_identifier> *online_members = nullptr)
167  : packet(nullptr),
168  log_event(base_event),
169  event_context(modifier),
170  format_descriptor(fde_event),
171  m_consistency_level(consistency_level),
172  m_online_members(online_members),
173  m_online_members_memory_ownership(true) {}
174 
176  if (packet != nullptr) {
177  delete packet;
178  }
179  if (log_event != nullptr) {
180  delete log_event;
181  }
182  if (m_online_members_memory_ownership) {
183  delete m_online_members;
184  }
185  }
186 
187  /**
188  Return current format description event.
189 
190  @param[out] out_fde the outputted format description event
191 
192  @return Operation status
193  @retval 0 OK
194  */
196  *out_fde = format_descriptor;
197  return 0;
198  }
199 
200  /**
201  Return a log event. If one does not exist, the contained packet will be
202  converted into one.
203 
204  @param[out] out_event the outputted log event
205 
206  @return Operation status
207  @retval 0 OK
208  @retval !=0 error on conversion
209  */
210  int get_LogEvent(Log_event **out_event) {
211  if (log_event == nullptr)
212  if (int error = convert_packet_to_log_event())
213  return error; /* purecov: inspected */
214  *out_event = log_event;
215  return 0;
216  }
217 
218  /**
219  Sets the pipeline event's log event.
220 
221  @note This methods assume you have called reset_pipeline_event
222 
223  @param[in] in_event the given log event
224  */
225  void set_LogEvent(Log_event *in_event) { log_event = in_event; }
226 
227  /**
228  Sets the pipeline event's packet.
229 
230  @note This methods assume you have called reset_pipeline_event
231 
232  @param[in] in_packet the given packet
233  */
234  void set_Packet(Data_packet *in_packet) { packet = in_packet; }
235 
236  /**
237  Return a packet. If one does not exist, the contained log event will be
238  converted into one.
239 
240  @param[out] out_packet the outputted packet
241 
242  @return the operation status
243  @retval 0 OK
244  @retval !=0 error on conversion
245  */
246  int get_Packet(Data_packet **out_packet) {
247  if (packet == nullptr)
248  if (int error = convert_log_event_to_packet())
249  return error; /* purecov: inspected */
250  *out_packet = packet;
251  return 0;
252  }
253 
254  /**
255  Returns the event type.
256  Be it a Log_event or Packet, it's marked with a type we can extract.
257 
258  @return the pipeline event type
259  */
261  if (packet != nullptr)
262  return (Log_event_type)packet->payload[EVENT_TYPE_OFFSET];
263  else
264  return log_event->get_type_code();
265  }
266 
267  /**
268  Sets the event context flag.
269 
270  @param[in] modifier the event modifier
271  */
272  void mark_event(int modifier) { event_context = modifier; }
273 
274  /**
275  Returns the event context flag
276  */
277  int get_event_context() { return event_context; }
278 
279  /**
280  Resets all variables in the event for reuse.
281  Possible existing events/packets are deleted.
282  The context flag is reset to UNDEFINED.
283  Error messages are deleted.
284 
285  Format description events, are NOT deleted.
286  This is due to the fact that they are given, and do not belong to the
287  pipeline event.
288 
289  Transaction consistency level is not reset, despite the event
290  is reset, consistency level belongs to the transaction.
291  */
293  if (packet != nullptr) {
294  delete packet; /* purecov: inspected */
295  packet = nullptr; /* purecov: inspected */
296  }
297  if (log_event != nullptr) {
298  delete log_event;
299  log_event = nullptr;
300  }
301  event_context = UNDEFINED_EVENT_MODIFIER;
302  }
303 
304  /**
305  Get transaction consistency level.
306  */
308  return m_consistency_level;
309  }
310 
311  /**
312  Get the list of ONLINE Group members when a
313  Transaction_with_guarantee_message message was received, or NULL if
314  if any group member version is from a version lower than
315  #TRANSACTION_WITH_GUARANTEES_VERSION.
316  For Transaction_message messages it always return NULL
317 
318  @return list of all ONLINE members, if all members have version
319  equal or greater than #TRANSACTION_WITH_GUARANTEES_VERSION
320  for Transaction_with_guarantee_message messages
321  otherwise NULL
322 
323  @note the memory allocated for the list ownership belongs to the
324  caller
325  */
326  std::list<Gcs_member_identifier> *get_online_members() {
327  return m_online_members;
328  }
329 
330  /**
331  Release memory ownership of m_online_members.
332  */
334  m_online_members_memory_ownership = false;
335  }
336 
337  private:
338  /**
339  Converts the existing packet into a log event.
340 
341  @return the operation status
342  @retval 0 OK
343  @retval 1 Error on packet conversion
344  */
346  uint event_len = uint4korr(((uchar *)(packet->payload)) + EVENT_LEN_OFFSET);
347  Binlog_read_error binlog_read_error = binlog_event_deserialize(
348  packet->payload, event_len, format_descriptor, true, &log_event);
349 
350  if (unlikely(binlog_read_error.has_error())) {
351  LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT,
352  binlog_read_error.get_str()); /* purecov: inspected */
353  }
354 
355  delete packet;
356  packet = nullptr;
357 
358  return binlog_read_error.has_error();
359  }
360 
361  /**
362  Converts the existing log event into a packet.
363 
364  @return the operation status
365  @retval 0 OK
366  @retval !=0 Error on log event conversion
367  */
369  int error = 0;
371 
372  if ((error = log_event->write(&ostream))) {
373  LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_EVENT_TO_PACKET,
374  "Out of memory"); /* purecov: inspected */
375  return error; /* purecov: inspected */
376  }
377 
378  packet = new Data_packet(reinterpret_cast<const uchar *>(ostream.c_ptr()),
379  ostream.length());
380 
381  delete log_event;
382  log_event = nullptr;
383 
384  return error;
385  }
386 
387  private:
391  /* Format description event used on conversions */
394  std::list<Gcs_member_identifier> *m_online_members;
396 };
397 
398 /**
399  @class Continuation
400 
401  Class used to wait on the execution of some action.
402  The class can also be used to report whenever a transaction is discarded
403  as a result of execution.
404 */
406  public:
407  Continuation() : ready(false), error_code(0), transaction_discarded(false) {
411  }
412 
415  mysql_cond_destroy(&cond);
416  }
417 
418  /**
419  Wait until release.
420 
421  @note The continuation will not wait if an error as occurred in the past
422  until reset_error_code() is invoked.
423 
424  @return the end status
425  @retval 0 OK
426  @retval !=0 Error returned on the execution
427  */
428  int wait() {
430  while (!ready && !error_code) {
431  mysql_cond_wait(&cond, &lock); /* purecov: inspected */
432  }
433  ready = false;
435 
436  return error_code;
437  }
438 
439  /**
440  Signal the continuation that execution can continue.
441 
442  @param[in] error the error code if any
443  @param[in] tran_discarded if the transaction to whom the event belongs
444  was discarded
445  */
446  void signal(int error = 0, bool tran_discarded = false) {
447  transaction_discarded = tran_discarded;
448  error_code = error;
449 
451  ready = true;
453  mysql_cond_broadcast(&cond);
454  }
455 
456  /**
457  Reset the error code after a reported error.
458  */
459  void reset_error_code() { error_code = 0; }
460 
461  /**
462  Sets the value of the flag for discarded transactions.
463 
464  @param[in] discarded is the transaction discarded.
465  */
466  void set_transation_discarded(bool discarded) {
467  transaction_discarded = discarded;
468  }
469 
470  /**
471  Says if a transaction was discarded or not.
472 
473  @return the transaction discarded flag
474  @retval 0 not discarded
475  @retval !=0 discarded
476  */
477  bool is_transaction_discarded() { return transaction_discarded; }
478 
479  private:
482  bool ready;
485 };
486 
487 /**
488  @class Pipeline_action
489 
490  A wrapper for pipeline actions.
491  Pipeline actions, unlike normal events, do not transport data but execution
492  instructions to be executed.
493 
494  @note On pipelines, actions unlike events, when submitted are always executed
495  synchronously, meaning that when the call returns all handlers already
496  processed it.
497  Actions are good for executing start and stop actions for example, but
498  also for configuring handlers.
499 */
501  public:
502  Pipeline_action(int action_type) { type = action_type; }
503 
504  virtual ~Pipeline_action() {}
505 
506  /**
507  Returns this action type.
508  The type must be defined in all child classes.
509  Different developing contexts can mean different sets of actions.
510 
511  @return the action type
512  */
513  int get_action_type() { return type; }
514 
515  private:
516  int type;
517 };
518 
519 /**
520  @class Event_handler
521 
522  Interface for the application of events, them being packets or log events.
523  Instances of this class can be composed among them to form execution
524  pipelines.
525 
526  Handlers can also have roles that define their type of activity and can be
527  used to identify them in a pipeline.
528  Roles are defined by the user of this class according to his context.
529 */
531  public:
532  Event_handler() : next_in_pipeline(nullptr) {}
533 
534  virtual ~Event_handler() {}
535 
536  /**
537  Initialization as defined in the handler implementation.
538 
539  @note It's up to the developer to decide its own initialization strategy,
540  but the suggested approach is to initialize basic structures here and
541  then depend on Action packets to configure and start existing handler
542  routines.
543  */
544  virtual int initialize() = 0;
545 
546  /**
547  Terminate the execution as defined in the handler implementation.
548  */
549  virtual int terminate() = 0;
550 
551  /**
552  Handling of an event as defined in the handler implementation.
553 
554  As the handler can be included in a pipeline, somewhere in the
555  method, the handler.next(event,continuation) method shall be
556  invoked to allow the passing of the event to the next handler.
557 
558  Also, if an error occurs, the continuation object shall be used to
559  propagate such error. This class can also be used to know/report
560  when the transaction to whom the event belongs was discarded.
561 
562  @param[in] event the pipeline event to be handled
563  @param[in,out] continuation termination notification object.
564  */
565  virtual int handle_event(Pipeline_event *event,
566  Continuation *continuation) = 0;
567 
568  /**
569  Handling of an action as defined in the handler implementation.
570 
571  As the handler can be included in a pipeline, somewhere in the
572  method, the handler.next(action) method shall be invoked to allow
573  the passing of the action to the next handler.
574 
575  @note Actions should not be treated asynchronously and as so, Continuations
576  are not used here. Errors are returned directly or passed by in the action
577  if it includes support for such
578 
579  @param[in] action the pipeline event to be handled
580  */
581  virtual int handle_action(Pipeline_action *action) = 0;
582 
583  // pipeline appending methods
584 
585  /**
586  Plug an handler to be the next in line for execution.
587 
588  @param[in] next_handler the next handler in line
589  */
590  void plug_next_handler(Event_handler *next_handler) {
591  next_in_pipeline = next_handler;
592  }
593 
594  /**
595  Append an handler to be the last in line for execution.
596 
597  @param[in] last_handler the last handler in line
598  */
599  void append(Event_handler *last_handler) {
600  Event_handler *pipeline_iter = this;
601  while (pipeline_iter->next_in_pipeline) {
602  pipeline_iter = pipeline_iter->next_in_pipeline;
603  }
604  pipeline_iter->plug_next_handler(last_handler);
605  }
606 
607  /**
608  Append an handler to a given pipeline.
609 
610  @note if the pipeline is null, the given handler will take its place
611 
612  @param[in,out] pipeline the pipeline to append the handler
613  @param[in] event_handler the event handler to append
614  */
615  static void append_handler(Event_handler **pipeline,
617  if (!(*pipeline))
618  *pipeline = event_handler;
619  else
620  (*pipeline)->append(event_handler);
621  }
622 
623  // pipeline information methods
624 
625  /**
626  Returns an handler that plays the given role
627 
628  @note if the pipeline is null, or the handler is not found, the retrieved
629  handler will be null.
630 
631  @param[in] pipeline the handler pipeline
632  @param[in] role the role to retrieve
633  @param[out] event_handler the retrieved event handler
634  */
635  static void get_handler_by_role(Event_handler *pipeline, int role,
637  *event_handler = nullptr;
638 
639  if (pipeline == nullptr) return; /* purecov: inspected */
640 
641  Event_handler *pipeline_iter = pipeline;
642  while (pipeline_iter) {
643  if (pipeline_iter->get_role() == role) {
644  *event_handler = pipeline_iter;
645  return;
646  }
647  pipeline_iter = pipeline_iter->next_in_pipeline;
648  }
649  }
650 
651  /**
652  This method identifies the handler as being unique.
653 
654  An handler that is defined as unique is an handler that cannot be used
655  more than once in a pipeline. Such tasks as certification and event
656  application can only be done once. Unique handlers are also the only that,
657  by being one of a kind, can be extracted during the pipeline life allowing
658  dynamic changes to them.
659 
660  @return if the handler is the a unique handler
661  @retval true is a unique handler
662  @retval false is a repeatable handler
663  */
664  virtual bool is_unique() = 0;
665 
666  /**
667  This method returns the handler role.
668  Handlers can have different roles according to the tasks they
669  represent. Is based on this role that certain components can
670  extract and interact with pipeline handlers. This means that if a
671  role is given to a singleton handler, no one else can have that
672  role.
673 
674  @return the handler role
675  */
676  virtual int get_role() = 0;
677 
678  // pipeline destruction methods
679 
680  /**
681  Shutdown and delete all handlers in the pipeline.
682 
683  @return the operation status
684  @retval 0 OK
685  @retval !=0 Error
686  */
688  int error = 0;
689  while (next_in_pipeline != nullptr) {
690  Event_handler *pipeline_iter = this;
691  Event_handler *temp_handler = nullptr;
692  while (pipeline_iter->next_in_pipeline != nullptr) {
693  temp_handler = pipeline_iter;
694  pipeline_iter = pipeline_iter->next_in_pipeline;
695  }
696  if (pipeline_iter->terminate())
697  error = 1; // report an error, but try to finish the job /* purecov:
698  // inspected */
699  delete temp_handler->next_in_pipeline;
700  temp_handler->next_in_pipeline = nullptr;
701  }
702  this->terminate();
703  return error;
704  }
705 
706  protected:
707  /**
708  Pass the event to the next handler in line. If none exists, this method
709  will signal the continuation method and exit.
710 
711  @param[in] event the pipeline event to be handled
712  @param[in,out] continuation termination notification object.
713  */
714  int next(Pipeline_event *event, Continuation *continuation) {
715  if (next_in_pipeline)
716  next_in_pipeline->handle_event(event, continuation);
717  else
718  continuation->signal();
719  return 0;
720  }
721 
722  /**
723  Pass the action to the next handler in line.
724  If none exists, this method will return
725 
726  @param[in] action the pipeline action to be handled
727  */
728  int next(Pipeline_action *action) {
729  int error = 0;
730 
731  if (next_in_pipeline) error = next_in_pipeline->handle_action(action);
732 
733  return error;
734  }
735 
736  private:
737  // The next handler in the pipeline
739 };
740 
741 #endif
#define EVENT_LEN_OFFSET
Definition: binlog_event.h:386
static void event_handler(const int fd, const short which, void *arg)
Definition: memcached.c:5667
static void append_handler(Event_handler **pipeline, Event_handler *event_handler)
Append an handler to a given pipeline.
Definition: pipeline_interfaces.h:615
unsigned char uchar
Definition: my_inttypes.h:51
int type
Definition: pipeline_interfaces.h:516
Event_handler()
Definition: pipeline_interfaces.h:532
A wrapper for pipeline actions.
Definition: pipeline_interfaces.h:500
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
void reset_pipeline_event()
Resets all variables in the event for reuse.
Definition: pipeline_interfaces.h:292
#define mysql_mutex_destroy(M)
Definition: mysql_mutex.h:45
enum_group_replication_consistency_level m_consistency_level
Definition: pipeline_interfaces.h:393
bool is_transaction_discarded()
Says if a transaction was discarded or not.
Definition: pipeline_interfaces.h:477
Log_event * log_event
Definition: pipeline_interfaces.h:389
uchar * payload
Definition: pipeline_interfaces.h:99
For binlog version 4.
Definition: log_event.h:1613
std::list< Gcs_member_identifier > * m_online_members
Definition: pipeline_interfaces.h:394
std::list< Gcs_member_identifier > * m_online_members
Definition: pipeline_interfaces.h:102
Log_event_type get_event_type()
Returns the event type.
Definition: pipeline_interfaces.h:260
int next(Pipeline_action *action)
Pass the action to the next handler in line.
Definition: pipeline_interfaces.h:728
char * c_ptr()
Definition: sql_string.h:248
const char * get_str() const
Return error message of the error type.
Definition: binlog_istream.cc:33
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:39
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
#define mysql_cond_wait(C, M)
Definition: mysql_cond.h:47
Class used to wait on the execution of some action.
Definition: pipeline_interfaces.h:405
A wrapper for raw network packets.
Definition: pipeline_interfaces.h:70
~Data_packet()
Definition: pipeline_interfaces.h:94
Log_event_type
Enumeration type for the different types of log events.
Definition: binlog_event.h:265
bool initialize(THD *thd)
Initialize the dictionary while starting the server for the first time.
Definition: bootstrapper.cc:869
int event_context
Definition: pipeline_interfaces.h:390
#define UNDEFINED_EVENT_MODIFIER
Definition: pipeline_interfaces.h:106
#define mysql_cond_destroy(C)
Definition: mysql_cond.h:44
static void get_handler_by_role(Event_handler *pipeline, int role, Event_handler **event_handler)
Returns an handler that plays the given role.
Definition: pipeline_interfaces.h:635
A wrapper for log events/packets.
Definition: pipeline_interfaces.h:122
bool ready
Definition: pipeline_interfaces.h:482
int get_LogEvent(Log_event **out_event)
Return a log event.
Definition: pipeline_interfaces.h:210
int get_action_type()
Returns this action type.
Definition: pipeline_interfaces.h:513
virtual int terminate()=0
Terminate the execution as defined in the handler implementation.
int convert_log_event_to_packet()
Converts the existing log event into a packet.
Definition: pipeline_interfaces.h:368
#define MYF(v)
#define DATA_PACKET_TYPE
Definition: pipeline_interfaces.h:38
A basic output stream based on StringBuffer class.
Definition: basic_ostream.h:157
Definition: plugin_group_replication.h:36
static std::mutex lock
Definition: net_ns.cc:55
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:144
enum_group_replication_consistency_level
Definition: plugin_group_replication.h:34
int get_event_context()
Returns the event context flag.
Definition: pipeline_interfaces.h:277
bool unlikely(bool expr)
Definition: my_compiler.h:55
This is the abstract base class for binary log events.
Definition: log_event.h:659
#define mysql_mutex_init(K, M, A)
Definition: mysql_mutex.h:40
bool m_online_members_memory_ownership
Definition: pipeline_interfaces.h:395
Pipeline_event(Data_packet *base_packet, Format_description_log_event *fde_event, int modifier=UNDEFINED_EVENT_MODIFIER, enum_group_replication_consistency_level consistency_level=GROUP_REPLICATION_CONSISTENCY_EVENTUAL, std::list< Gcs_member_identifier > *online_members=nullptr)
Create a new pipeline wrapper based on a packet.
Definition: pipeline_interfaces.h:136
Data_packet * packet
Definition: pipeline_interfaces.h:388
enum_group_replication_consistency_level get_consistency_level()
Get transaction consistency level.
Definition: pipeline_interfaces.h:307
virtual int get_role()=0
This method returns the handler role.
int next(Pipeline_event *event, Continuation *continuation)
Pass the event to the next handler in line.
Definition: pipeline_interfaces.h:714
void plug_next_handler(Event_handler *next_handler)
Plug an handler to be the next in line for execution.
Definition: pipeline_interfaces.h:590
unsigned int uint
Definition: uca-dump.cc:29
#define true
Definition: config_static.h:44
int(* mysql_cond_broadcast)(mysql_cond_t *that, const char *src_file, unsigned int src_line)
Definition: mysql_cond_service.h:51
ulong len
Definition: pipeline_interfaces.h:100
void mark_event(int modifier)
Sets the event context flag.
Definition: pipeline_interfaces.h:272
Pipeline_action(int action_type)
Definition: pipeline_interfaces.h:502
int get_Packet(Data_packet **out_packet)
Return a packet.
Definition: pipeline_interfaces.h:246
Pipeline_event(Log_event *base_event, Format_description_log_event *fde_event, int modifier=UNDEFINED_EVENT_MODIFIER, enum_group_replication_consistency_level consistency_level=GROUP_REPLICATION_CONSISTENCY_EVENTUAL, std::list< Gcs_member_identifier > *online_members=nullptr)
Create a new pipeline wrapper based on a log event.
Definition: pipeline_interfaces.h:162
void set_transation_discarded(bool discarded)
Sets the value of the flag for discarded transactions.
Definition: pipeline_interfaces.h:466
#define mysql_cond_init(K, C)
Definition: mysql_cond.h:41
virtual ~Pipeline_action()
Definition: pipeline_interfaces.h:504
A generic interface for different kinds of packets.
Definition: pipeline_interfaces.h:45
~Continuation()
Definition: pipeline_interfaces.h:413
Data_packet(const uchar *data, ulong len, enum_group_replication_consistency_level consistency_level=GROUP_REPLICATION_CONSISTENCY_EVENTUAL, std::list< Gcs_member_identifier > *online_members=nullptr)
Create a new data packet wrapper.
Definition: pipeline_interfaces.h:81
void reset_error_code()
Reset the error code after a reported error.
Definition: pipeline_interfaces.h:459
void set_Packet(Data_packet *in_packet)
Sets the pipeline event&#39;s packet.
Definition: pipeline_interfaces.h:234
int terminate_pipeline()
Shutdown and delete all handlers in the pipeline.
Definition: pipeline_interfaces.h:687
#define EVENT_TYPE_OFFSET
Definition: binlog_event.h:384
void append(Event_handler *last_handler)
Append an handler to be the last in line for execution.
Definition: pipeline_interfaces.h:599
Definition: my_loglevel.h:34
Format_description_log_event * format_descriptor
Definition: pipeline_interfaces.h:392
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
virtual ~Packet()
Definition: pipeline_interfaces.h:54
int wait()
Wait until release.
Definition: pipeline_interfaces.h:428
Event_handler * next_in_pipeline
Definition: pipeline_interfaces.h:738
void release_online_members_memory_ownership()
Release memory ownership of m_online_members.
Definition: pipeline_interfaces.h:333
Continuation()
Definition: pipeline_interfaces.h:407
API for Group Replication plugin.
Binlog_read_error::Error_type binlog_event_deserialize(const unsigned char *buffer, unsigned int event_len, const Format_description_event *fde, bool verify_checksum, Log_event **event)
Deserialize a binlog event from event_data.
Definition: binlog_reader.cc:109
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:56
int convert_packet_to_log_event()
Converts the existing packet into a log event.
Definition: pipeline_interfaces.h:345
void signal(int error=0, bool tran_discarded=false)
Signal the continuation that execution can continue.
Definition: pipeline_interfaces.h:446
bool transaction_discarded
Definition: pipeline_interfaces.h:484
int get_packet_type()
Definition: pipeline_interfaces.h:59
mysql_cond_t cond
Definition: pipeline_interfaces.h:481
#define MY_MUTEX_INIT_FAST
Definition: thr_mutex.h:66
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:49
It defines the error types which could happen when reading binlog files or deserializing binlog event...
Definition: binlog_istream.h:36
Interface for the application of events, them being packets or log events.
Definition: pipeline_interfaces.h:530
const enum_group_replication_consistency_level m_consistency_level
Definition: pipeline_interfaces.h:101
PSI_mutex_key key_GR_LOCK_pipeline_continuation
Definition: plugin_psi.cc:30
virtual ~Event_handler()
Definition: pipeline_interfaces.h:534
Packet(int type)
Create a new generic packet of a certain type.
Definition: pipeline_interfaces.h:52
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Below functions are used by the components.
Definition: my_memory.cc:57
~Pipeline_event()
Definition: pipeline_interfaces.h:175
bool has_error()
Definition: binlog_istream.h:79
#define false
Definition: config_static.h:43
mysql_mutex_t lock
Definition: pipeline_interfaces.h:480
int error_code
Definition: pipeline_interfaces.h:483
std::list< Gcs_member_identifier > * get_online_members()
Get the list of ONLINE Group members when a Transaction_with_guarantee_message message was received...
Definition: pipeline_interfaces.h:326
size_t length() const
Definition: sql_string.h:238
int packet_type
Definition: pipeline_interfaces.h:62
void set_LogEvent(Log_event *in_event)
Sets the pipeline event&#39;s log event.
Definition: pipeline_interfaces.h:225
bool terminate(THD *thd)
Drop all DD tables in case there is an error while upgrading server.
Definition: upgrade.cc:682
int get_FormatDescription(Format_description_log_event **out_fde)
Return current format description event.
Definition: pipeline_interfaces.h:195
Dialog Client Authentication nullptr
Definition: dialog.cc:353
PSI_cond_key key_GR_COND_pipeline_continuation
Definition: plugin_psi.cc:82