MySQL 8.4.0
Source Code Documentation
pipeline_interfaces.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2024, 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);
476 packet->payload, event_len, format_descriptor, true, &log_event);
477
478 if (unlikely(binlog_read_error.has_error())) {
479 LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT,
480 binlog_read_error.get_str()); /* purecov: inspected */
481 }
482
483 delete packet;
484 packet = nullptr;
485
486 return binlog_read_error.has_error();
487 }
488
489 /**
490 Converts the existing log event into a packet.
491
492 @return the operation status
493 @retval 0 OK
494 @retval !=0 Error on log event conversion
495 */
497 int error = 0;
499
500 if ((error = log_event->write(&ostream))) {
501 LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_EVENT_TO_PACKET,
502 "Out of memory"); /* purecov: inspected */
503 return error; /* purecov: inspected */
504 }
505
506 packet = new Data_packet(reinterpret_cast<const uchar *>(ostream.c_ptr()),
507 ostream.length(), key_transaction_data);
508
509 delete log_event;
510 log_event = nullptr;
511
512 return error;
513 }
514
515 private:
520 /* Format description event used on conversions */
527};
528
529/**
530 @class Continuation
531
532 Class used to wait on the execution of some action.
533 The class can also be used to report whenever a transaction is discarded
534 as a result of execution.
535*/
537 public:
542 }
543
547 }
548
549 /**
550 Wait until release.
551
552 @note The continuation will not wait if an error as occurred in the past
553 until reset_error_code() is invoked.
554
555 @return the end status
556 @retval 0 OK
557 @retval !=0 Error returned on the execution
558 */
559 int wait() {
561 while (!ready && !error_code) {
562 mysql_cond_wait(&cond, &lock); /* purecov: inspected */
563 }
564 ready = false;
566
567 return error_code;
568 }
569
570 /**
571 Signal the continuation that execution can continue.
572
573 @param[in] error the error code if any
574 @param[in] tran_discarded if the transaction to whom the event belongs
575 was discarded
576 */
577 void signal(int error = 0, bool tran_discarded = false) {
578 transaction_discarded = tran_discarded;
580
582 ready = true;
585 }
586
587 /**
588 Reset the error code after a reported error.
589 */
591
592 /**
593 Sets the value of the flag for discarded transactions.
594
595 @param[in] discarded is the transaction discarded.
596 */
597 void set_transation_discarded(bool discarded) {
598 transaction_discarded = discarded;
599 }
600
601 /**
602 Says if a transaction was discarded or not.
603
604 @return the transaction discarded flag
605 @retval 0 not discarded
606 @retval !=0 discarded
607 */
609
610 private:
613 bool ready;
616};
617
618/**
619 @class Pipeline_action
620
621 A wrapper for pipeline actions.
622 Pipeline actions, unlike normal events, do not transport data but execution
623 instructions to be executed.
624
625 @note On pipelines, actions unlike events, when submitted are always executed
626 synchronously, meaning that when the call returns all handlers already
627 processed it.
628 Actions are good for executing start and stop actions for example, but
629 also for configuring handlers.
630*/
632 public:
633 Pipeline_action(int action_type) { type = action_type; }
634
635 virtual ~Pipeline_action() = default;
636
637 /**
638 Returns this action type.
639 The type must be defined in all child classes.
640 Different developing contexts can mean different sets of actions.
641
642 @return the action type
643 */
644 int get_action_type() { return type; }
645
646 private:
647 int type;
648};
649
650/**
651 @class Event_handler
652
653 Interface for the application of events, them being packets or log events.
654 Instances of this class can be composed among them to form execution
655 pipelines.
656
657 Handlers can also have roles that define their type of activity and can be
658 used to identify them in a pipeline.
659 Roles are defined by the user of this class according to his context.
660*/
662 public:
664
665 virtual ~Event_handler() = default;
666
667 /**
668 Initialization as defined in the handler implementation.
669
670 @note It's up to the developer to decide its own initialization strategy,
671 but the suggested approach is to initialize basic structures here and
672 then depend on Action packets to configure and start existing handler
673 routines.
674 */
675 virtual int initialize() = 0;
676
677 /**
678 Terminate the execution as defined in the handler implementation.
679 */
680 virtual int terminate() = 0;
681
682 /**
683 Handling of an event as defined in the handler implementation.
684
685 As the handler can be included in a pipeline, somewhere in the
686 method, the handler.next(event,continuation) method shall be
687 invoked to allow the passing of the event to the next handler.
688
689 Also, if an error occurs, the continuation object shall be used to
690 propagate such error. This class can also be used to know/report
691 when the transaction to whom the event belongs was discarded.
692
693 @param[in] event the pipeline event to be handled
694 @param[in,out] continuation termination notification object.
695 */
697 Continuation *continuation) = 0;
698
699 /**
700 Handling of an action as defined in the handler implementation.
701
702 As the handler can be included in a pipeline, somewhere in the
703 method, the handler.next(action) method shall be invoked to allow
704 the passing of the action to the next handler.
705
706 @note Actions should not be treated asynchronously and as so, Continuations
707 are not used here. Errors are returned directly or passed by in the action
708 if it includes support for such
709
710 @param[in] action the pipeline event to be handled
711 */
713
714 // pipeline appending methods
715
716 /**
717 Plug an handler to be the next in line for execution.
718
719 @param[in] next_handler the next handler in line
720 */
721 void plug_next_handler(Event_handler *next_handler) {
722 next_in_pipeline = next_handler;
723 }
724
725 /**
726 Append an handler to be the last in line for execution.
727
728 @param[in] last_handler the last handler in line
729 */
730 void append(Event_handler *last_handler) {
731 Event_handler *pipeline_iter = this;
732 while (pipeline_iter->next_in_pipeline) {
733 pipeline_iter = pipeline_iter->next_in_pipeline;
734 }
735 pipeline_iter->plug_next_handler(last_handler);
736 }
737
738 /**
739 Append an handler to a given pipeline.
740
741 @note if the pipeline is null, the given handler will take its place
742
743 @param[in,out] pipeline the pipeline to append the handler
744 @param[in] event_handler the event handler to append
745 */
746 static void append_handler(Event_handler **pipeline,
747 Event_handler *event_handler) {
748 if (!(*pipeline))
749 *pipeline = event_handler;
750 else
751 (*pipeline)->append(event_handler);
752 }
753
754 // pipeline information methods
755
756 /**
757 Returns an handler that plays the given role
758
759 @note if the pipeline is null, or the handler is not found, the retrieved
760 handler will be null.
761
762 @param[in] pipeline the handler pipeline
763 @param[in] role the role to retrieve
764 @param[out] event_handler the retrieved event handler
765 */
766 static void get_handler_by_role(Event_handler *pipeline, int role,
767 Event_handler **event_handler) {
768 *event_handler = nullptr;
769
770 if (pipeline == nullptr) return; /* purecov: inspected */
771
772 Event_handler *pipeline_iter = pipeline;
773 while (pipeline_iter) {
774 if (pipeline_iter->get_role() == role) {
775 *event_handler = pipeline_iter;
776 return;
777 }
778 pipeline_iter = pipeline_iter->next_in_pipeline;
779 }
780 }
781
782 /**
783 This method identifies the handler as being unique.
784
785 An handler that is defined as unique is an handler that cannot be used
786 more than once in a pipeline. Such tasks as certification and event
787 application can only be done once. Unique handlers are also the only that,
788 by being one of a kind, can be extracted during the pipeline life allowing
789 dynamic changes to them.
790
791 @return if the handler is the a unique handler
792 @retval true is a unique handler
793 @retval false is a repeatable handler
794 */
795 virtual bool is_unique() = 0;
796
797 /**
798 This method returns the handler role.
799 Handlers can have different roles according to the tasks they
800 represent. Is based on this role that certain components can
801 extract and interact with pipeline handlers. This means that if a
802 role is given to a singleton handler, no one else can have that
803 role.
804
805 @return the handler role
806 */
807 virtual int get_role() = 0;
808
809 // pipeline destruction methods
810
811 /**
812 Shutdown and delete all handlers in the pipeline.
813
814 @return the operation status
815 @retval 0 OK
816 @retval !=0 Error
817 */
819 int error = 0;
820 while (next_in_pipeline != nullptr) {
821 Event_handler *pipeline_iter = this;
822 Event_handler *temp_handler = nullptr;
823 while (pipeline_iter->next_in_pipeline != nullptr) {
824 temp_handler = pipeline_iter;
825 pipeline_iter = pipeline_iter->next_in_pipeline;
826 }
827 if (pipeline_iter->terminate())
828 error = 1; // report an error, but try to finish the job /* purecov:
829 // inspected */
830 delete temp_handler->next_in_pipeline;
831 temp_handler->next_in_pipeline = nullptr;
832 }
833 this->terminate();
834 return error;
835 }
836
837 protected:
838 /**
839 Pass the event to the next handler in line. If none exists, this method
840 will signal the continuation method and exit.
841
842 @param[in] event the pipeline event to be handled
843 @param[in,out] continuation termination notification object.
844 */
845 int next(Pipeline_event *event, Continuation *continuation) {
847 next_in_pipeline->handle_event(event, continuation);
848 else
849 continuation->signal();
850 return 0;
851 }
852
853 /**
854 Pass the action to the next handler in line.
855 If none exists, this method will return
856
857 @param[in] action the pipeline action to be handled
858 */
860 int error = 0;
861
863
864 return error;
865 }
866
867 private:
868 // The next handler in the pipeline
870};
871
872#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:536
void reset_error_code()
Reset the error code after a reported error.
Definition: pipeline_interfaces.h:590
void signal(int error=0, bool tran_discarded=false)
Signal the continuation that execution can continue.
Definition: pipeline_interfaces.h:577
mysql_cond_t cond
Definition: pipeline_interfaces.h:612
mysql_mutex_t lock
Definition: pipeline_interfaces.h:611
bool transaction_discarded
Definition: pipeline_interfaces.h:615
~Continuation()
Definition: pipeline_interfaces.h:544
Continuation()
Definition: pipeline_interfaces.h:538
void set_transation_discarded(bool discarded)
Sets the value of the flag for discarded transactions.
Definition: pipeline_interfaces.h:597
int wait()
Wait until release.
Definition: pipeline_interfaces.h:559
int error_code
Definition: pipeline_interfaces.h:614
bool ready
Definition: pipeline_interfaces.h:613
bool is_transaction_discarded()
Says if a transaction was discarded or not.
Definition: pipeline_interfaces.h:608
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:661
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:818
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:766
int next(Pipeline_event *event, Continuation *continuation)
Pass the event to the next handler in line.
Definition: pipeline_interfaces.h:845
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:869
void append(Event_handler *last_handler)
Append an handler to be the last in line for execution.
Definition: pipeline_interfaces.h:730
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:663
void plug_next_handler(Event_handler *next_handler)
Plug an handler to be the next in line for execution.
Definition: pipeline_interfaces.h:721
int next(Pipeline_action *action)
Pass the action to the next handler in line.
Definition: pipeline_interfaces.h:859
static void append_handler(Event_handler **pipeline, Event_handler *event_handler)
Append an handler to a given pipeline.
Definition: pipeline_interfaces.h:746
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:631
virtual ~Pipeline_action()=default
int type
Definition: pipeline_interfaces.h:647
Pipeline_action(int action_type)
Definition: pipeline_interfaces.h:633
int get_action_type()
Returns this action type.
Definition: pipeline_interfaces.h:644
A wrapper for log events/packets.
Definition: pipeline_interfaces.h:167
bool m_online_members_memory_ownership
Definition: pipeline_interfaces.h:524
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:519
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:496
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:521
int get_event_context()
Returns the event context flag.
Definition: pipeline_interfaces.h:360
Data_packet * packet
Definition: pipeline_interfaces.h:516
enum_group_replication_consistency_level m_consistency_level
Definition: pipeline_interfaces.h:522
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:517
Members_list * m_online_members
Definition: pipeline_interfaces.h:523
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:518
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:526
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:525
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:2878
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