24#ifndef PIPELINE_INTERFACES_INCLUDED
25#define PIPELINE_INTERFACES_INCLUDED
33#include "mysqld_error.h"
43#define DATA_PACKET_TYPE 1
90 std::list<Gcs_member_identifier> *online_members =
nullptr)
112#define UNDEFINED_EVENT_MODIFIER 0
115#define DEFAULT_EVENT_BUFFER_SIZE 16384
377 DELAYED_VIEW_CHANGE_WAITING_FOR_CONSISTENT_TRANSACTIONS);
407 LogPluginErr(
ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT,
429 LogPluginErr(
ERROR_LEVEL, ER_GRP_RPL_UNABLE_TO_CONVERT_EVENT_TO_PACKET,
675 *pipeline = event_handler;
677 (*pipeline)->
append(event_handler);
694 *event_handler =
nullptr;
696 if (pipeline ==
nullptr)
return;
699 while (pipeline_iter) {
700 if (pipeline_iter->
get_role() == role) {
701 *event_handler = pipeline_iter;
750 temp_handler = pipeline_iter;
#define EVENT_TYPE_OFFSET
Definition: binlog_event.h:409
#define EVENT_LEN_OFFSET
Definition: binlog_event.h:411
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:118
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:80
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:462
void reset_error_code()
Reset the error code after a reported error.
Definition: pipeline_interfaces.h:516
void signal(int error=0, bool tran_discarded=false)
Signal the continuation that execution can continue.
Definition: pipeline_interfaces.h:503
mysql_cond_t cond
Definition: pipeline_interfaces.h:538
mysql_mutex_t lock
Definition: pipeline_interfaces.h:537
bool transaction_discarded
Definition: pipeline_interfaces.h:541
~Continuation()
Definition: pipeline_interfaces.h:470
Continuation()
Definition: pipeline_interfaces.h:464
void set_transation_discarded(bool discarded)
Sets the value of the flag for discarded transactions.
Definition: pipeline_interfaces.h:523
int wait()
Wait until release.
Definition: pipeline_interfaces.h:485
int error_code
Definition: pipeline_interfaces.h:540
bool ready
Definition: pipeline_interfaces.h:539
bool is_transaction_discarded()
Says if a transaction was discarded or not.
Definition: pipeline_interfaces.h:534
A wrapper for raw network packets.
Definition: pipeline_interfaces.h:75
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:87
~Data_packet() override
Definition: pipeline_interfaces.h:100
ulong len
Definition: pipeline_interfaces.h:106
std::list< Gcs_member_identifier > * m_online_members
Definition: pipeline_interfaces.h:108
const enum_group_replication_consistency_level m_consistency_level
Definition: pipeline_interfaces.h:107
uchar * payload
Definition: pipeline_interfaces.h:105
Interface for the application of events, them being packets or log events.
Definition: pipeline_interfaces.h:587
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:744
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:692
int next(Pipeline_event *event, Continuation *continuation)
Pass the event to the next handler in line.
Definition: pipeline_interfaces.h:771
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:795
void append(Event_handler *last_handler)
Append an handler to be the last in line for execution.
Definition: pipeline_interfaces.h:656
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:589
void plug_next_handler(Event_handler *next_handler)
Plug an handler to be the next in line for execution.
Definition: pipeline_interfaces.h:647
int next(Pipeline_action *action)
Pass the action to the next handler in line.
Definition: pipeline_interfaces.h:785
static void append_handler(Event_handler **pipeline, Event_handler *event_handler)
Append an handler to a given pipeline.
Definition: pipeline_interfaces.h:672
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:541
virtual 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:50
int packet_type
Definition: pipeline_interfaces.h:67
int get_packet_type()
Definition: pipeline_interfaces.h:64
virtual ~Packet()=default
Packet(int type)
Create a new generic packet of a certain type.
Definition: pipeline_interfaces.h:57
A wrapper for pipeline actions.
Definition: pipeline_interfaces.h:557
virtual ~Pipeline_action()=default
int type
Definition: pipeline_interfaces.h:573
Pipeline_action(int action_type)
Definition: pipeline_interfaces.h:559
int get_action_type()
Returns this action type.
Definition: pipeline_interfaces.h:570
A wrapper for log events/packets.
Definition: pipeline_interfaces.h:128
bool m_online_members_memory_ownership
Definition: pipeline_interfaces.h:451
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:174
bool is_delayed_view_change_resumed()
Check if old view change processing is resumed.
Definition: pipeline_interfaces.h:388
Log_event_type get_event_type()
Returns the event type.
Definition: pipeline_interfaces.h:272
int event_context
Definition: pipeline_interfaces.h:446
int convert_packet_to_log_event()
Converts the existing packet into a log event.
Definition: pipeline_interfaces.h:401
~Pipeline_event()
Definition: pipeline_interfaces.h:187
int convert_log_event_to_packet()
Converts the existing log event into a packet.
Definition: pipeline_interfaces.h:424
void mark_event(int modifier)
Sets the event context flag.
Definition: pipeline_interfaces.h:284
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:338
Format_description_log_event * format_descriptor
Definition: pipeline_interfaces.h:448
int get_event_context()
Returns the event context flag.
Definition: pipeline_interfaces.h:289
Data_packet * packet
Definition: pipeline_interfaces.h:444
enum_group_replication_consistency_level m_consistency_level
Definition: pipeline_interfaces.h:449
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:374
void release_online_members_memory_ownership()
Release memory ownership of m_online_members.
Definition: pipeline_interfaces.h:343
void set_LogEvent(Log_event *in_event)
Sets the pipeline event's log event.
Definition: pipeline_interfaces.h:237
void set_Packet(Data_packet *in_packet)
Sets the pipeline event's packet.
Definition: pipeline_interfaces.h:246
int get_Packet(Data_packet **out_packet)
Return a packet.
Definition: pipeline_interfaces.h:258
void reset_pipeline_event()
Resets all variables in the event for reuse.
Definition: pipeline_interfaces.h:304
bool is_delayed_view_change_waiting_for_consistent_transactions()
Check if current view change is delayed due to consistent transaction.
Definition: pipeline_interfaces.h:364
Log_event * log_event
Definition: pipeline_interfaces.h:445
Members_list * m_online_members
Definition: pipeline_interfaces.h:450
int get_FormatDescription(Format_description_log_event **out_fde)
Return current format description event.
Definition: pipeline_interfaces.h:207
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:351
Processing_state
Definition: pipeline_interfaces.h:129
@ DELAYED_VIEW_CHANGE_RESUMED
@ DELAYED_VIEW_CHANGE_WAITING_FOR_CONSISTENT_TRANSACTIONS
enum_group_replication_consistency_level get_consistency_level()
Get transaction consistency level.
Definition: pipeline_interfaces.h:319
int get_LogEvent(Log_event **out_event)
Return a log event.
Definition: pipeline_interfaces.h:222
Processing_state m_packet_processing_state
Definition: pipeline_interfaces.h:452
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:148
A basic output stream based on StringBuffer class.
Definition: basic_ostream.h:161
char * c_ptr()
Definition: sql_string.h:252
size_t length() const
Definition: sql_string.h:242
#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
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:145
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:56
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
Log_event_type
Enumeration type for the different types of log events.
Definition: binlog_event.h:275
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
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:112
#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:154
PSI_mutex_key key_GR_LOCK_pipeline_continuation
Definition: plugin_psi.h:101
PSI_memory_key key_transaction_data
Definition: plugin_psi.h:238
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
unsigned int uint
Definition: uca9-dump.cc:75