24#ifndef PIPELINE_INTERFACES_INCLUDED
25#define PIPELINE_INTERFACES_INCLUDED
33#include "mysqld_error.h"
43#define DATA_PACKET_TYPE 1
44#define VIEW_CHANGE_PACKET_TYPE 3
91 std::list<Gcs_member_identifier> *online_members =
nullptr)
151#define UNDEFINED_EVENT_MODIFIER 0
154#define DEFAULT_EVENT_BUFFER_SIZE 16384
449 DELAYED_VIEW_CHANGE_WAITING_FOR_CONSISTENT_TRANSACTIONS);
479 LogPluginErr(
ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT,
501 LogPluginErr(
ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_EVENT_TO_PACKET,
749 *pipeline = event_handler;
751 (*pipeline)->
append(event_handler);
768 *event_handler =
nullptr;
770 if (pipeline ==
nullptr)
return;
773 while (pipeline_iter) {
774 if (pipeline_iter->
get_role() == role) {
775 *event_handler = pipeline_iter;
824 temp_handler = pipeline_iter;
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
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
@ PEVENT_APPLIER_ONLY_EVENT_E
@ PEVENT_DATA_PACKET_TYPE_E
@ PEVENT_BINARY_LOG_EVENT_TYPE_E
Pipeline_event_type get_pipeline_event_type()
Definition: pipeline_interfaces.h:296
Processing_state
Definition: pipeline_interfaces.h:168
@ DELAYED_VIEW_CHANGE_RESUMED
@ DELAYED_VIEW_CHANGE_WAITING_FOR_CONSISTENT_TRANSACTIONS
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