MySQL 8.4.9
Source Code Documentation
pipeline_interfaces.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2026, 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 PIPELINE_INTERFACES_INCLUDED
25#define PIPELINE_INTERFACES_INCLUDED
26
27#include <list>
28
32
33#include "mysqld_error.h"
37
41
42// Define the data packet type
43#define DATA_PACKET_TYPE 1
44#define VIEW_CHANGE_PACKET_TYPE 3
45
46/**
47 @class Packet
48
49 A generic interface for different kinds of packets.
50*/
51class Packet {
52 public:
53 /**
54 Create a new generic packet of a certain type.
55
56 @param[in] type the packet type
57 */
59
60 virtual ~Packet() = default;
61
62 /**
63 @return the packet type
64 */
65 int get_packet_type() { return packet_type; }
66
67 private:
69};
70
71/**
72 @class Data_packet
73
74 A wrapper for raw network packets.
75*/
76class Data_packet : public Packet {
77 public:
78 /**
79 Create a new data packet wrapper.
80
81 @param[in] data the packet data
82 @param[in] len the packet length
83 @param[in] key the memory instrument key
84 @param[in] consistency_level the transaction consistency level
85 @param[in] online_members the ONLINE members when the transaction
86 message was delivered
87 */
88 Data_packet(const uchar *data, ulong len, PSI_memory_key key,
91 std::list<Gcs_member_identifier> *online_members = nullptr)
94 len(len),
95 m_consistency_level(consistency_level),
96 m_online_members(online_members) {
97 payload = (uchar *)my_malloc(key, len, MYF(0));
98 memcpy(payload, data, len);
99 }
100
101 ~Data_packet() override {
103 delete m_online_members;
104 }
105
107 ulong len;
109 std::list<Gcs_member_identifier> *m_online_members;
110};
111
112/**
113 @class View_change_packet
114 A packet to send view change related info to the applier
115*/
117 public:
118 /**
119 Create a new data packet with associated data.
120
121 @param view_id_arg The view id associated to this view
122 @param need_vcle The flag determine if View_change_log_event is needed.
123 */
124 View_change_packet(std::string &view_id_arg, bool need_vcle)
126 view_id(view_id_arg),
127 m_need_vcle(need_vcle) {}
130 view_id(packet->view_id),
134 m_need_vcle(packet->m_need_vcle) {}
135
136 ~View_change_packet() override = default;
137
138 /* View ID of the view. */
139 const std::string view_id;
140 /* Group executed GTID-SET picked from group members. */
141 std::vector<std::string> group_executed_set;
142 /* Online members during view-change. */
143 std::vector<Gcs_member_identifier> m_valid_sender_list;
144 /* New members joining in the view. */
145 std::vector<Gcs_member_identifier> m_members_joining_in_view;
146 /* Does any members needs VCLE to be logged? */
147 const bool m_need_vcle;
148};
149
150// Define the data packet type
151#define UNDEFINED_EVENT_MODIFIER 0
152
153// Define the size of the pipeline event buffer
154#define DEFAULT_EVENT_BUFFER_SIZE 16384
155
156/**
157 @class Pipeline_event
158
159 A wrapper for log events/packets. This class allows for the marking of events
160 and its transformation between the packet and log event formats as requested
161 in the interface.
162
163 @note Events can be marked as with event modifiers.
164 This is a generic field allowing modifiers to vary with use context.
165 If not specified, this field has a default value of 0.
166*/
168 enum class Processing_state {
169 DEFAULT,
172 };
173
174 public:
179 };
180
181 /**
182 Create a new pipeline wrapper based on a packet.
183
184 @note If a modifier is not provided the event will be marked as `UNDEFINED`
185
186 @param[in] base_packet the wrapper packet
187 @param[in] fde_event the format description event for conversions
188 @param[in] modifier the event modifier
189 @param[in] consistency_level the transaction consistency level
190 @param[in] online_members the ONLINE members when the transaction
191 message was delivered
192 */
195 int modifier = UNDEFINED_EVENT_MODIFIER,
198 Members_list *online_members = nullptr)
199 : packet(base_packet),
201 event_context(modifier),
202 format_descriptor(fde_event),
203 m_consistency_level(consistency_level),
204 m_online_members(online_members),
207 Pipeline_event_type::PEVENT_DATA_PACKET_TYPE_E) {}
208
209 /**
210 Create a new pipeline wrapper based on a log event.
211
212 @note If a modifier is not provided the event will be marked as `UNDEFINED`
213
214 @param[in] base_event the wrapper log event
215 @param[in] fde_event the format description event for conversions
216 @param[in] modifier the event modifier
217 @param[in] consistency_level the transaction consistency level
218 @param[in] online_members the ONLINE members when the transaction
219 message was delivered
220 */
222 int modifier = UNDEFINED_EVENT_MODIFIER,
225 Members_list *online_members = nullptr)
226 : packet(nullptr),
227 log_event(base_event),
228 event_context(modifier),
229 format_descriptor(fde_event),
230 m_consistency_level(consistency_level),
231 m_online_members(online_members),
234 Pipeline_event_type::PEVENT_BINARY_LOG_EVENT_TYPE_E) {}
235
239 Members_list *online_members = nullptr)
240 : packet(nullptr),
243 event_context(modifier),
245 m_consistency_level(consistency_level),
246 m_online_members(online_members),
249 Pipeline_event_type::PEVENT_APPLIER_ONLY_EVENT_E) {}
250
252 if (packet != nullptr) {
253 delete packet;
254 }
255 if (log_event != nullptr) {
256 delete log_event;
257 }
258 if (packet_event != nullptr) {
259 delete packet_event;
260 }
262 delete m_online_members;
263 }
264 }
265
266 /**
267 Return current format description event.
268
269 @param[out] out_fde the outputted format description event
270
271 @return Operation status
272 @retval 0 OK
273 */
275 *out_fde = format_descriptor;
276 return 0;
277 }
278
279 /**
280 Return a log event. If one does not exist, the contained packet will be
281 converted into one.
282
283 @param[out] out_event the outputted log event
284
285 @return Operation status
286 @retval 0 OK
287 @retval !=0 error on conversion
288 */
289 int get_LogEvent(Log_event **out_event) {
290 if (log_event == nullptr)
292 return error; /* purecov: inspected */
293 *out_event = log_event;
294 return 0;
295 }
298 }
299
300 /**
301 Sets the pipeline event's log event.
302
303 @note This methods assume you have called reset_pipeline_event
304
305 @param[in] in_event the given log event
306 */
307 void set_LogEvent(Log_event *in_event) { log_event = in_event; }
308
309 /**
310 Sets the pipeline event's packet.
311
312 @note This methods assume you have called reset_pipeline_event
313
314 @param[in] in_packet the given packet
315 */
316 void set_Packet(Data_packet *in_packet) { packet = in_packet; }
317
318 /**
319 Return a packet. If one does not exist, the contained log event will be
320 converted into one.
321
322 @param[out] out_packet the outputted packet
323
324 @return the operation status
325 @retval 0 OK
326 @retval !=0 error on conversion
327 */
328 int get_Packet(Data_packet **out_packet) {
329 if (packet == nullptr)
331 return error; /* purecov: inspected */
332 *out_packet = packet;
333 return 0;
334 }
335
336 /**
337 Returns the event type.
338 Be it a Log_event or Packet, it's marked with a type we can extract.
339
340 @return the pipeline event type
341 */
343 if (packet != nullptr)
346 else
347 return log_event->get_type_code();
348 }
349
350 /**
351 Sets the event context flag.
352
353 @param[in] modifier the event modifier
354 */
355 void mark_event(int modifier) { event_context = modifier; }
356
357 /**
358 Returns the event context flag
359 */
361
362 /**
363 Resets all variables in the event for reuse.
364 Possible existing events/packets are deleted.
365 The context flag is reset to UNDEFINED.
366 Error messages are deleted.
367
368 Format description events, are NOT deleted.
369 This is due to the fact that they are given, and do not belong to the
370 pipeline event.
371
372 Transaction consistency level is not reset, despite the event
373 is reset, consistency level belongs to the transaction.
374 */
376 if (packet != nullptr) {
377 delete packet; /* purecov: inspected */
378 packet = nullptr; /* purecov: inspected */
379 }
380 if (log_event != nullptr) {
381 delete log_event;
382 log_event = nullptr;
383 }
385 }
386
387 /**
388 Get transaction consistency level.
389 */
391 return m_consistency_level;
392 }
393
394 /**
395 Get the list of ONLINE Group members when a
396 Transaction_with_guarantee_message message was received, or NULL if
397 if any group member version is from a version lower than
398 #TRANSACTION_WITH_GUARANTEES_VERSION.
399 For Transaction_message messages it always return NULL
400
401 @return list of all ONLINE members, if all members have version
402 equal or greater than #TRANSACTION_WITH_GUARANTEES_VERSION
403 for Transaction_with_guarantee_message messages
404 otherwise NULL
405
406 @note the memory allocated for the list ownership belongs to the
407 caller
408 */
411
412 /**
413 Release memory ownership of m_online_members.
414 */
417 }
418
419 /**
420 Set view change cannot be processed now and should be delayed due to
421 consistent transaction.
422 */
427 }
428
429 /**
430 Check if current view change is delayed due to consistent transaction.
431
432 @return is event being queued for later processing
433 @retval true event is being queued
434 @retval false event is not being queued
435 */
440 }
441
442 /**
443 Allow resume the log of delayed views that were waiting for consistent
444 transactions from previous view to complete.
445 */
449 DELAYED_VIEW_CHANGE_WAITING_FOR_CONSISTENT_TRANSACTIONS);
451 }
452
453 /**
454 Check if old view change processing is resumed.
455
456 @return is event being processed from queue
457 @retval true event is being processed from queue
458 @retval false event is not being processed from queue
459 */
463 }
464
465 private:
466 /**
467 Converts the existing packet into a log event.
468
469 @return the operation status
470 @retval 0 OK
471 @retval 1 Error on packet conversion
472 */
474 uint event_len = uint4korr(((uchar *)(packet->payload)) + EVENT_LEN_OFFSET);
475
476 if (event_len > packet->len) {
477 LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT,
478 "invalid event length.");
479 return 1;
480 }
481
483 packet->payload, event_len, format_descriptor, true, &log_event);
484
485 if (unlikely(binlog_read_error.has_error())) {
486 LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT,
487 binlog_read_error.get_str()); /* purecov: inspected */
488 }
489
490 delete packet;
491 packet = nullptr;
492
493 return binlog_read_error.has_error();
494 }
495
496 /**
497 Converts the existing log event into a packet.
498
499 @return the operation status
500 @retval 0 OK
501 @retval !=0 Error on log event conversion
502 */
504 int error = 0;
506
507 if ((error = log_event->write(&ostream))) {
508 LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_EVENT_TO_PACKET,
509 "Out of memory"); /* purecov: inspected */
510 return error; /* purecov: inspected */
511 }
512
513 packet = new Data_packet(reinterpret_cast<const uchar *>(ostream.c_ptr()),
514 ostream.length(), key_transaction_data);
515
516 delete log_event;
517 log_event = nullptr;
518
519 return error;
520 }
521
522 private:
527 /* Format description event used on conversions */
534};
535
536/**
537 @class Continuation
538
539 Class used to wait on the execution of some action.
540 The class can also be used to report whenever a transaction is discarded
541 as a result of execution.
542*/
544 public:
549 }
550
554 }
555
556 /**
557 Wait until release.
558
559 @note The continuation will not wait if an error as occurred in the past
560 until reset_error_code() is invoked.
561
562 @return the end status
563 @retval 0 OK
564 @retval !=0 Error returned on the execution
565 */
566 int wait() {
568 while (!ready && !error_code) {
569 mysql_cond_wait(&cond, &lock); /* purecov: inspected */
570 }
571 ready = false;
573
574 return error_code;
575 }
576
577 /**
578 Signal the continuation that execution can continue.
579
580 @param[in] error the error code if any
581 @param[in] tran_discarded if the transaction to whom the event belongs
582 was discarded
583 */
584 void signal(int error = 0, bool tran_discarded = false) {
585 transaction_discarded = tran_discarded;
587
589 ready = true;
592 }
593
594 /**
595 Reset the error code after a reported error.
596 */
598
599 /**
600 Sets the value of the flag for discarded transactions.
601
602 @param[in] discarded is the transaction discarded.
603 */
604 void set_transation_discarded(bool discarded) {
605 transaction_discarded = discarded;
606 }
607
608 /**
609 Says if a transaction was discarded or not.
610
611 @return the transaction discarded flag
612 @retval 0 not discarded
613 @retval !=0 discarded
614 */
616
617 private:
620 bool ready;
623};
624
625/**
626 @class Pipeline_action
627
628 A wrapper for pipeline actions.
629 Pipeline actions, unlike normal events, do not transport data but execution
630 instructions to be executed.
631
632 @note On pipelines, actions unlike events, when submitted are always executed
633 synchronously, meaning that when the call returns all handlers already
634 processed it.
635 Actions are good for executing start and stop actions for example, but
636 also for configuring handlers.
637*/
639 public:
640 Pipeline_action(int action_type) { type = action_type; }
641
642 virtual ~Pipeline_action() = default;
643
644 /**
645 Returns this action type.
646 The type must be defined in all child classes.
647 Different developing contexts can mean different sets of actions.
648
649 @return the action type
650 */
651 int get_action_type() { return type; }
652
653 private:
654 int type;
655};
656
657/**
658 @class Event_handler
659
660 Interface for the application of events, them being packets or log events.
661 Instances of this class can be composed among them to form execution
662 pipelines.
663
664 Handlers can also have roles that define their type of activity and can be
665 used to identify them in a pipeline.
666 Roles are defined by the user of this class according to his context.
667*/
669 public:
671
672 virtual ~Event_handler() = default;
673
674 /**
675 Initialization as defined in the handler implementation.
676
677 @note It's up to the developer to decide its own initialization strategy,
678 but the suggested approach is to initialize basic structures here and
679 then depend on Action packets to configure and start existing handler
680 routines.
681 */
682 virtual int initialize() = 0;
683
684 /**
685 Terminate the execution as defined in the handler implementation.
686 */
687 virtual int terminate() = 0;
688
689 /**
690 Handling of an event as defined in the handler implementation.
691
692 As the handler can be included in a pipeline, somewhere in the
693 method, the handler.next(event,continuation) method shall be
694 invoked to allow the passing of the event to the next handler.
695
696 Also, if an error occurs, the continuation object shall be used to
697 propagate such error. This class can also be used to know/report
698 when the transaction to whom the event belongs was discarded.
699
700 @param[in] event the pipeline event to be handled
701 @param[in,out] continuation termination notification object.
702 */
704 Continuation *continuation) = 0;
705
706 /**
707 Handling of an action as defined in the handler implementation.
708
709 As the handler can be included in a pipeline, somewhere in the
710 method, the handler.next(action) method shall be invoked to allow
711 the passing of the action to the next handler.
712
713 @note Actions should not be treated asynchronously and as so, Continuations
714 are not used here. Errors are returned directly or passed by in the action
715 if it includes support for such
716
717 @param[in] action the pipeline event to be handled
718 */
720
721 // pipeline appending methods
722
723 /**
724 Plug an handler to be the next in line for execution.
725
726 @param[in] next_handler the next handler in line
727 */
728 void plug_next_handler(Event_handler *next_handler) {
729 next_in_pipeline = next_handler;
730 }
731
732 /**
733 Append an handler to be the last in line for execution.
734
735 @param[in] last_handler the last handler in line
736 */
737 void append(Event_handler *last_handler) {
738 Event_handler *pipeline_iter = this;
739 while (pipeline_iter->next_in_pipeline) {
740 pipeline_iter = pipeline_iter->next_in_pipeline;
741 }
742 pipeline_iter->plug_next_handler(last_handler);
743 }
744
745 /**
746 Append an handler to a given pipeline.
747
748 @note if the pipeline is null, the given handler will take its place
749
750 @param[in,out] pipeline the pipeline to append the handler
751 @param[in] event_handler the event handler to append
752 */
753 static void append_handler(Event_handler **pipeline,
754 Event_handler *event_handler) {
755 if (!(*pipeline))
756 *pipeline = event_handler;
757 else
758 (*pipeline)->append(event_handler);
759 }
760
761 // pipeline information methods
762
763 /**
764 Returns an handler that plays the given role
765
766 @note if the pipeline is null, or the handler is not found, the retrieved
767 handler will be null.
768
769 @param[in] pipeline the handler pipeline
770 @param[in] role the role to retrieve
771 @param[out] event_handler the retrieved event handler
772 */
773 static void get_handler_by_role(Event_handler *pipeline, int role,
774 Event_handler **event_handler) {
775 *event_handler = nullptr;
776
777 if (pipeline == nullptr) return; /* purecov: inspected */
778
779 Event_handler *pipeline_iter = pipeline;
780 while (pipeline_iter) {
781 if (pipeline_iter->get_role() == role) {
782 *event_handler = pipeline_iter;
783 return;
784 }
785 pipeline_iter = pipeline_iter->next_in_pipeline;
786 }
787 }
788
789 /**
790 This method identifies the handler as being unique.
791
792 An handler that is defined as unique is an handler that cannot be used
793 more than once in a pipeline. Such tasks as certification and event
794 application can only be done once. Unique handlers are also the only that,
795 by being one of a kind, can be extracted during the pipeline life allowing
796 dynamic changes to them.
797
798 @return if the handler is the a unique handler
799 @retval true is a unique handler
800 @retval false is a repeatable handler
801 */
802 virtual bool is_unique() = 0;
803
804 /**
805 This method returns the handler role.
806 Handlers can have different roles according to the tasks they
807 represent. Is based on this role that certain components can
808 extract and interact with pipeline handlers. This means that if a
809 role is given to a singleton handler, no one else can have that
810 role.
811
812 @return the handler role
813 */
814 virtual int get_role() = 0;
815
816 // pipeline destruction methods
817
818 /**
819 Shutdown and delete all handlers in the pipeline.
820
821 @return the operation status
822 @retval 0 OK
823 @retval !=0 Error
824 */
826 int error = 0;
827 while (next_in_pipeline != nullptr) {
828 Event_handler *pipeline_iter = this;
829 Event_handler *temp_handler = nullptr;
830 while (pipeline_iter->next_in_pipeline != nullptr) {
831 temp_handler = pipeline_iter;
832 pipeline_iter = pipeline_iter->next_in_pipeline;
833 }
834 if (pipeline_iter->terminate())
835 error = 1; // report an error, but try to finish the job /* purecov:
836 // inspected */
837 delete temp_handler->next_in_pipeline;
838 temp_handler->next_in_pipeline = nullptr;
839 }
840 this->terminate();
841 return error;
842 }
843
844 protected:
845 /**
846 Pass the event to the next handler in line. If none exists, this method
847 will signal the continuation method and exit.
848
849 @param[in] event the pipeline event to be handled
850 @param[in,out] continuation termination notification object.
851 */
852 int next(Pipeline_event *event, Continuation *continuation) {
854 next_in_pipeline->handle_event(event, continuation);
855 else
856 continuation->signal();
857 return 0;
858 }
859
860 /**
861 Pass the action to the next handler in line.
862 If none exists, this method will return
863
864 @param[in] action the pipeline action to be handled
865 */
867 int error = 0;
868
870
871 return error;
872 }
873
874 private:
875 // The next handler in the pipeline
877};
878
879#endif
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
#define EVENT_TYPE_OFFSET
Definition: binlog_event.h:431
#define EVENT_LEN_OFFSET
Definition: binlog_event.h:433
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:125
It defines the error types which could happen when reading binlog files or deserializing binlog event...
Definition: binlog_istream.h:37
bool has_error() const
Definition: binlog_istream.h:82
const char * get_str() const
Return error message of the error type.
Definition: binlog_istream.cc:34
Class used to wait on the execution of some action.
Definition: pipeline_interfaces.h:543
void reset_error_code()
Reset the error code after a reported error.
Definition: pipeline_interfaces.h:597
void signal(int error=0, bool tran_discarded=false)
Signal the continuation that execution can continue.
Definition: pipeline_interfaces.h:584
mysql_cond_t cond
Definition: pipeline_interfaces.h:619
mysql_mutex_t lock
Definition: pipeline_interfaces.h:618
bool transaction_discarded
Definition: pipeline_interfaces.h:622
~Continuation()
Definition: pipeline_interfaces.h:551
Continuation()
Definition: pipeline_interfaces.h:545
void set_transation_discarded(bool discarded)
Sets the value of the flag for discarded transactions.
Definition: pipeline_interfaces.h:604
int wait()
Wait until release.
Definition: pipeline_interfaces.h:566
int error_code
Definition: pipeline_interfaces.h:621
bool ready
Definition: pipeline_interfaces.h:620
bool is_transaction_discarded()
Says if a transaction was discarded or not.
Definition: pipeline_interfaces.h:615
A wrapper for raw network packets.
Definition: pipeline_interfaces.h:76
Data_packet(const uchar *data, ulong len, PSI_memory_key key, 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:88
~Data_packet() override
Definition: pipeline_interfaces.h:101
ulong len
Definition: pipeline_interfaces.h:107
std::list< Gcs_member_identifier > * m_online_members
Definition: pipeline_interfaces.h:109
const enum_group_replication_consistency_level m_consistency_level
Definition: pipeline_interfaces.h:108
uchar * payload
Definition: pipeline_interfaces.h:106
Interface for the application of events, them being packets or log events.
Definition: pipeline_interfaces.h:668
virtual int get_role()=0
This method returns the handler role.
virtual int handle_action(Pipeline_action *action)=0
Handling of an action as defined in the handler implementation.
int terminate_pipeline()
Shutdown and delete all handlers in the pipeline.
Definition: pipeline_interfaces.h:825
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:773
int next(Pipeline_event *event, Continuation *continuation)
Pass the event to the next handler in line.
Definition: pipeline_interfaces.h:852
virtual int initialize()=0
Initialization as defined in the handler implementation.
virtual int terminate()=0
Terminate the execution as defined in the handler implementation.
Event_handler * next_in_pipeline
Definition: pipeline_interfaces.h:876
void append(Event_handler *last_handler)
Append an handler to be the last in line for execution.
Definition: pipeline_interfaces.h:737
virtual ~Event_handler()=default
virtual bool is_unique()=0
This method identifies the handler as being unique.
virtual int handle_event(Pipeline_event *event, Continuation *continuation)=0
Handling of an event as defined in the handler implementation.
Event_handler()
Definition: pipeline_interfaces.h:670
void plug_next_handler(Event_handler *next_handler)
Plug an handler to be the next in line for execution.
Definition: pipeline_interfaces.h:728
int next(Pipeline_action *action)
Pass the action to the next handler in line.
Definition: pipeline_interfaces.h:866
static void append_handler(Event_handler **pipeline, Event_handler *event_handler)
Append an handler to a given pipeline.
Definition: pipeline_interfaces.h:753
For binlog version 4.
Definition: log_event.h:1525
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
This is the abstract base class for binary log events.
Definition: log_event.h:538
virtual mysql::binlog::event::Log_event_type get_type_code() const
Definition: log_event.h:797
virtual bool write(Basic_ostream *ostream)
Definition: log_event.h:785
Malloc_allocator is a C++ STL memory allocator based on my_malloc/my_free.
Definition: malloc_allocator.h:63
A generic interface for different kinds of packets.
Definition: pipeline_interfaces.h:51
int packet_type
Definition: pipeline_interfaces.h:68
int get_packet_type()
Definition: pipeline_interfaces.h:65
virtual ~Packet()=default
Packet(int type)
Create a new generic packet of a certain type.
Definition: pipeline_interfaces.h:58
A wrapper for pipeline actions.
Definition: pipeline_interfaces.h:638
virtual ~Pipeline_action()=default
int type
Definition: pipeline_interfaces.h:654
Pipeline_action(int action_type)
Definition: pipeline_interfaces.h:640
int get_action_type()
Returns this action type.
Definition: pipeline_interfaces.h:651
A wrapper for log events/packets.
Definition: pipeline_interfaces.h:167
bool m_online_members_memory_ownership
Definition: pipeline_interfaces.h:531
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, Members_list *online_members=nullptr)
Create a new pipeline wrapper based on a log event.
Definition: pipeline_interfaces.h:221
bool is_delayed_view_change_resumed()
Check if old view change processing is resumed.
Definition: pipeline_interfaces.h:460
int event_context
Definition: pipeline_interfaces.h:526
int convert_packet_to_log_event()
Converts the existing packet into a log event.
Definition: pipeline_interfaces.h:473
~Pipeline_event()
Definition: pipeline_interfaces.h:251
int convert_log_event_to_packet()
Converts the existing log event into a packet.
Definition: pipeline_interfaces.h:503
Packet * get_applier_event_packet()
Definition: pipeline_interfaces.h:410
void mark_event(int modifier)
Sets the event context flag.
Definition: pipeline_interfaces.h:355
Members_list * get_online_members()
Get the list of ONLINE Group members when a Transaction_with_guarantee_message message was received,...
Definition: pipeline_interfaces.h:409
Format_description_log_event * format_descriptor
Definition: pipeline_interfaces.h:528
int get_event_context()
Returns the event context flag.
Definition: pipeline_interfaces.h:360
Data_packet * packet
Definition: pipeline_interfaces.h:523
enum_group_replication_consistency_level m_consistency_level
Definition: pipeline_interfaces.h:529
void set_delayed_view_change_resumed()
Allow resume the log of delayed views that were waiting for consistent transactions from previous vie...
Definition: pipeline_interfaces.h:446
void release_online_members_memory_ownership()
Release memory ownership of m_online_members.
Definition: pipeline_interfaces.h:415
void set_LogEvent(Log_event *in_event)
Sets the pipeline event's log event.
Definition: pipeline_interfaces.h:307
void set_Packet(Data_packet *in_packet)
Sets the pipeline event's packet.
Definition: pipeline_interfaces.h:316
int get_Packet(Data_packet **out_packet)
Return a packet.
Definition: pipeline_interfaces.h:328
void reset_pipeline_event()
Resets all variables in the event for reuse.
Definition: pipeline_interfaces.h:375
bool is_delayed_view_change_waiting_for_consistent_transactions()
Check if current view change is delayed due to consistent transaction.
Definition: pipeline_interfaces.h:436
Log_event * log_event
Definition: pipeline_interfaces.h:524
Members_list * m_online_members
Definition: pipeline_interfaces.h:530
int get_FormatDescription(Format_description_log_event **out_fde)
Return current format description event.
Definition: pipeline_interfaces.h:274
void set_delayed_view_change_waiting_for_consistent_transactions()
Set view change cannot be processed now and should be delayed due to consistent transaction.
Definition: pipeline_interfaces.h:423
Packet * packet_event
Definition: pipeline_interfaces.h:525
Pipeline_event_type
Definition: pipeline_interfaces.h:175
Pipeline_event_type get_pipeline_event_type()
Definition: pipeline_interfaces.h:296
Processing_state
Definition: pipeline_interfaces.h:168
Pipeline_event(Packet *packet, int modifier=UNDEFINED_EVENT_MODIFIER, enum_group_replication_consistency_level consistency_level=GROUP_REPLICATION_CONSISTENCY_EVENTUAL, Members_list *online_members=nullptr)
Definition: pipeline_interfaces.h:236
enum_group_replication_consistency_level get_consistency_level()
Get transaction consistency level.
Definition: pipeline_interfaces.h:390
Pipeline_event_type m_processing_event_type
Definition: pipeline_interfaces.h:533
mysql::binlog::event::Log_event_type get_event_type()
Returns the event type.
Definition: pipeline_interfaces.h:342
int get_LogEvent(Log_event **out_event)
Return a log event.
Definition: pipeline_interfaces.h:289
Processing_state m_packet_processing_state
Definition: pipeline_interfaces.h:532
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, Members_list *online_members=nullptr)
Create a new pipeline wrapper based on a packet.
Definition: pipeline_interfaces.h:193
A basic output stream based on StringBuffer class.
Definition: basic_ostream.h:161
char * c_ptr()
Definition: sql_string.h:251
size_t length() const
Definition: sql_string.h:241
A packet to send view change related info to the applier.
Definition: pipeline_interfaces.h:116
std::vector< std::string > group_executed_set
Definition: pipeline_interfaces.h:141
const bool m_need_vcle
Definition: pipeline_interfaces.h:147
const std::string view_id
Definition: pipeline_interfaces.h:139
std::vector< Gcs_member_identifier > m_members_joining_in_view
Definition: pipeline_interfaces.h:145
View_change_packet(View_change_packet *packet)
Definition: pipeline_interfaces.h:128
View_change_packet(std::string &view_id_arg, bool need_vcle)
Create a new data packet with associated data.
Definition: pipeline_interfaces.h:124
~View_change_packet() override=default
std::vector< Gcs_member_identifier > m_valid_sender_list
Definition: pipeline_interfaces.h:143
#define mysql_cond_wait(C, M)
Definition: mysql_cond.h:48
#define mysql_cond_destroy(C)
Definition: mysql_cond.h:45
#define mysql_cond_init(K, C)
Definition: mysql_cond.h:42
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_destroy(M)
Definition: mysql_mutex.h:46
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
#define mysql_mutex_init(K, M, A)
Definition: mysql_mutex.h:41
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:152
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:58
unsigned char uchar
Definition: my_inttypes.h:52
#define MYF(v)
Definition: my_inttypes.h:97
@ ERROR_LEVEL
Definition: my_loglevel.h:43
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
int(* mysql_cond_broadcast)(mysql_cond_t *that, const char *src_file, unsigned int src_line)
Definition: mysql_cond_service.h:52
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
Log_event_type
Enumeration type for the different types of log events.
Definition: binlog_event.h:286
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2883
std::list< Gcs_member_identifier, Malloc_allocator< Gcs_member_identifier > > Members_list
Definition: pipeline_interfaces.h:40
#define UNDEFINED_EVENT_MODIFIER
Definition: pipeline_interfaces.h:151
#define VIEW_CHANGE_PACKET_TYPE
Definition: pipeline_interfaces.h:44
#define DATA_PACKET_TYPE
Definition: pipeline_interfaces.h:43
API for Group Replication plugin.
enum_group_replication_consistency_level
Definition: plugin_group_replication.h:35
@ GROUP_REPLICATION_CONSISTENCY_EVENTUAL
Definition: plugin_group_replication.h:37
PSI_cond_key key_GR_COND_pipeline_continuation
Definition: plugin_psi.h:155
PSI_mutex_key key_GR_LOCK_pipeline_continuation
Definition: plugin_psi.h:100
PSI_memory_key key_transaction_data
Definition: plugin_psi.h:240
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required string type
Definition: replication_group_member_actions.proto:34
repeated Action action
Definition: replication_group_member_actions.proto:43
required string event
Definition: replication_group_member_actions.proto:32
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
#define MY_MUTEX_INIT_FAST
Definition: thr_mutex.h:68