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