MySQL 9.7.0
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 struct timespec abstime;
570 set_timespec(&abstime, 1);
571 mysql_cond_timedwait(&cond, &lock, &abstime);
572 }
573 ready = false;
575
576 return error_code;
577 }
578
579 /**
580 Signal the continuation that execution can continue.
581
582 @param[in] error the error code if any
583 @param[in] tran_discarded if the transaction to whom the event belongs
584 was discarded
585 */
586 void signal(int error = 0, bool tran_discarded = false) {
587 transaction_discarded = tran_discarded;
589
591 ready = true;
594 }
595
596 /**
597 Reset the error code after a reported error.
598 */
600
601 /**
602 Sets the value of the flag for discarded transactions.
603
604 @param[in] discarded is the transaction discarded.
605 */
606 void set_transation_discarded(bool discarded) {
607 transaction_discarded = discarded;
608 }
609
610 /**
611 Says if a transaction was discarded or not.
612
613 @return the transaction discarded flag
614 @retval 0 not discarded
615 @retval !=0 discarded
616 */
618
619 private:
622 bool ready;
625};
626
627/**
628 @class Pipeline_action
629
630 A wrapper for pipeline actions.
631 Pipeline actions, unlike normal events, do not transport data but execution
632 instructions to be executed.
633
634 @note On pipelines, actions unlike events, when submitted are always executed
635 synchronously, meaning that when the call returns all handlers already
636 processed it.
637 Actions are good for executing start and stop actions for example, but
638 also for configuring handlers.
639*/
641 public:
642 Pipeline_action(int action_type) { type = action_type; }
643
644 virtual ~Pipeline_action() = default;
645
646 /**
647 Returns this action type.
648 The type must be defined in all child classes.
649 Different developing contexts can mean different sets of actions.
650
651 @return the action type
652 */
653 int get_action_type() { return type; }
654
655 private:
656 int type;
657};
658
659/**
660 @class Event_handler
661
662 Interface for the application of events, them being packets or log events.
663 Instances of this class can be composed among them to form execution
664 pipelines.
665
666 Handlers can also have roles that define their type of activity and can be
667 used to identify them in a pipeline.
668 Roles are defined by the user of this class according to his context.
669*/
671 public:
673
674 virtual ~Event_handler() = default;
675
676 /**
677 Initialization as defined in the handler implementation.
678
679 @note It's up to the developer to decide its own initialization strategy,
680 but the suggested approach is to initialize basic structures here and
681 then depend on Action packets to configure and start existing handler
682 routines.
683 */
684 virtual int initialize() = 0;
685
686 /**
687 Terminate the execution as defined in the handler implementation.
688 */
689 virtual int terminate() = 0;
690
691 /**
692 Handling of an event as defined in the handler implementation.
693
694 As the handler can be included in a pipeline, somewhere in the
695 method, the handler.next(event,continuation) method shall be
696 invoked to allow the passing of the event to the next handler.
697
698 Also, if an error occurs, the continuation object shall be used to
699 propagate such error. This class can also be used to know/report
700 when the transaction to whom the event belongs was discarded.
701
702 @param[in] event the pipeline event to be handled
703 @param[in,out] continuation termination notification object.
704 */
706 Continuation *continuation) = 0;
707
708 /**
709 Handling of an action as defined in the handler implementation.
710
711 As the handler can be included in a pipeline, somewhere in the
712 method, the handler.next(action) method shall be invoked to allow
713 the passing of the action to the next handler.
714
715 @note Actions should not be treated asynchronously and as so, Continuations
716 are not used here. Errors are returned directly or passed by in the action
717 if it includes support for such
718
719 @param[in] action the pipeline event to be handled
720 */
722
723 // pipeline appending methods
724
725 /**
726 Plug an handler to be the next in line for execution.
727
728 @param[in] next_handler the next handler in line
729 */
730 void plug_next_handler(Event_handler *next_handler) {
731 next_in_pipeline = next_handler;
732 }
733
734 /**
735 Append an handler to be the last in line for execution.
736
737 @param[in] last_handler the last handler in line
738 */
739 void append(Event_handler *last_handler) {
740 Event_handler *pipeline_iter = this;
741 while (pipeline_iter->next_in_pipeline) {
742 pipeline_iter = pipeline_iter->next_in_pipeline;
743 }
744 pipeline_iter->plug_next_handler(last_handler);
745 }
746
747 /**
748 Append an handler to a given pipeline.
749
750 @note if the pipeline is null, the given handler will take its place
751
752 @param[in,out] pipeline the pipeline to append the handler
753 @param[in] event_handler the event handler to append
754 */
755 static void append_handler(Event_handler **pipeline,
756 Event_handler *event_handler) {
757 if (!(*pipeline))
758 *pipeline = event_handler;
759 else
760 (*pipeline)->append(event_handler);
761 }
762
763 // pipeline information methods
764
765 /**
766 Returns an handler that plays the given role
767
768 @note if the pipeline is null, or the handler is not found, the retrieved
769 handler will be null.
770
771 @param[in] pipeline the handler pipeline
772 @param[in] role the role to retrieve
773 @param[out] event_handler the retrieved event handler
774 */
775 static void get_handler_by_role(Event_handler *pipeline, int role,
776 Event_handler **event_handler) {
777 *event_handler = nullptr;
778
779 if (pipeline == nullptr) return; /* purecov: inspected */
780
781 Event_handler *pipeline_iter = pipeline;
782 while (pipeline_iter) {
783 if (pipeline_iter->get_role() == role) {
784 *event_handler = pipeline_iter;
785 return;
786 }
787 pipeline_iter = pipeline_iter->next_in_pipeline;
788 }
789 }
790
791 /**
792 This method identifies the handler as being unique.
793
794 An handler that is defined as unique is an handler that cannot be used
795 more than once in a pipeline. Such tasks as certification and event
796 application can only be done once. Unique handlers are also the only that,
797 by being one of a kind, can be extracted during the pipeline life allowing
798 dynamic changes to them.
799
800 @return if the handler is the a unique handler
801 @retval true is a unique handler
802 @retval false is a repeatable handler
803 */
804 virtual bool is_unique() = 0;
805
806 /**
807 This method returns the handler role.
808 Handlers can have different roles according to the tasks they
809 represent. Is based on this role that certain components can
810 extract and interact with pipeline handlers. This means that if a
811 role is given to a singleton handler, no one else can have that
812 role.
813
814 @return the handler role
815 */
816 virtual int get_role() = 0;
817
818 // pipeline destruction methods
819
820 /**
821 Shutdown and delete all handlers in the pipeline.
822
823 @return the operation status
824 @retval 0 OK
825 @retval !=0 Error
826 */
828 int error = 0;
829 while (next_in_pipeline != nullptr) {
830 Event_handler *pipeline_iter = this;
831 Event_handler *temp_handler = nullptr;
832 while (pipeline_iter->next_in_pipeline != nullptr) {
833 temp_handler = pipeline_iter;
834 pipeline_iter = pipeline_iter->next_in_pipeline;
835 }
836 if (pipeline_iter->terminate())
837 error = 1; // report an error, but try to finish the job /* purecov:
838 // inspected */
839 delete temp_handler->next_in_pipeline;
840 temp_handler->next_in_pipeline = nullptr;
841 }
842 this->terminate();
843 return error;
844 }
845
846 protected:
847 /**
848 Pass the event to the next handler in line. If none exists, this method
849 will signal the continuation method and exit.
850
851 @param[in] event the pipeline event to be handled
852 @param[in,out] continuation termination notification object.
853 */
854 int next(Pipeline_event *event, Continuation *continuation) {
856 next_in_pipeline->handle_event(event, continuation);
857 else
858 continuation->signal();
859 return 0;
860 }
861
862 /**
863 Pass the action to the next handler in line.
864 If none exists, this method will return
865
866 @param[in] action the pipeline action to be handled
867 */
869 int error = 0;
870
872
873 return error;
874 }
875
876 private:
877 // The next handler in the pipeline
879};
880
881#endif
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
#define EVENT_TYPE_OFFSET
Definition: binlog_event.h:424
#define EVENT_LEN_OFFSET
Definition: binlog_event.h:426
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:599
void signal(int error=0, bool tran_discarded=false)
Signal the continuation that execution can continue.
Definition: pipeline_interfaces.h:586
mysql_cond_t cond
Definition: pipeline_interfaces.h:621
mysql_mutex_t lock
Definition: pipeline_interfaces.h:620
bool transaction_discarded
Definition: pipeline_interfaces.h:624
~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:606
int wait()
Wait until release.
Definition: pipeline_interfaces.h:566
int error_code
Definition: pipeline_interfaces.h:623
bool ready
Definition: pipeline_interfaces.h:622
bool is_transaction_discarded()
Says if a transaction was discarded or not.
Definition: pipeline_interfaces.h:617
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:670
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:827
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:775
int next(Pipeline_event *event, Continuation *continuation)
Pass the event to the next handler in line.
Definition: pipeline_interfaces.h:854
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:878
void append(Event_handler *last_handler)
Append an handler to be the last in line for execution.
Definition: pipeline_interfaces.h:739
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:672
void plug_next_handler(Event_handler *next_handler)
Plug an handler to be the next in line for execution.
Definition: pipeline_interfaces.h:730
int next(Pipeline_action *action)
Pass the action to the next handler in line.
Definition: pipeline_interfaces.h:868
static void append_handler(Event_handler **pipeline, Event_handler *event_handler)
Append an handler to a given pipeline.
Definition: pipeline_interfaces.h:755
For binlog version 4.
Definition: log_event.h:1536
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:539
virtual mysql::binlog::event::Log_event_type get_type_code() const
Definition: log_event.h:798
virtual bool write(Basic_ostream *ostream)
Definition: log_event.h:786
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:640
virtual ~Pipeline_action()=default
int type
Definition: pipeline_interfaces.h:656
Pipeline_action(int action_type)
Definition: pipeline_interfaces.h:642
int get_action_type()
Returns this action type.
Definition: pipeline_interfaces.h:653
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:160
char * c_ptr()
Definition: sql_string.h:253
size_t length() const
Definition: sql_string.h:243
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_destroy(C)
Definition: mysql_cond.h:45
#define mysql_cond_init(K, C)
Definition: mysql_cond.h:42
#define mysql_cond_timedwait(C, M, T)
Definition: mysql_cond.h:51
#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
void set_timespec(struct timespec *abstime, Timeout_type sec)
Set the value of a timespec object to the current time plus a number of seconds using seconds.
Definition: my_systime.cc:93
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:279
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2884
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:67