MySQL 8.4.2
Source Code Documentation
|
#include <gcs_xcom_communication_interface.h>
Public Member Functions | |
Gcs_xcom_communication (Gcs_xcom_statistics_manager_interface *stats, Gcs_xcom_proxy *proxy, Gcs_xcom_view_change_control_interface *view_control, Gcs_xcom_engine *gcs_engine, Gcs_group_identifier const &group_id, std::unique_ptr< Network_provider_management_interface > comms_mgmt) | |
Gcs_xcom_communication_interface constructor. More... | |
~Gcs_xcom_communication () override | |
enum_gcs_error | send_message (const Gcs_message &message_to_send) override |
Implementation of the public send_message method defined in Gcs_xcom_communication. More... | |
int | add_event_listener (const Gcs_communication_event_listener &event_listener) override |
Registers an implementation of a Gcs_communication_event_listener that will receive Communication Events. More... | |
void | remove_event_listener (int event_listener_handle) override |
Removes a previously registered event listener. More... | |
enum_gcs_error | do_send_message (const Gcs_message &message_to_send, unsigned long long *message_length, Cargo_type cargo) override |
Sends a message that is internal to the binding implementation. More... | |
std::map< int, const Gcs_communication_event_listener & > * | get_event_listeners () |
Gcs_message_pipeline & | get_msg_pipeline () override |
void | buffer_incoming_packet (Gcs_packet &&packet, std::unique_ptr< Gcs_xcom_nodes > &&xcom_nodes) override |
Buffer packets when a view is not installed yet and the state exchange phase is being executed. More... | |
void | deliver_buffered_packets () override |
The state exchange phase has been executed and the view has been installed so this is used to send any buffered packet to upper layers. More... | |
void | cleanup_buffered_packets () override |
size_t | number_buffered_packets () override |
Return the number of buffered packets. More... | |
void | update_members_information (const Gcs_member_identifier &me, const Gcs_xcom_nodes &members) override |
Notify the pipeline about the new XCom membership when a state exchange begins. More... | |
bool | recover_packets (Gcs_xcom_synode_set const &synodes) override |
Attempts to recover the missing packets that are required for a node to join the group successfully. More... | |
Gcs_message * | convert_packet_to_message (Gcs_packet &&packet, std::unique_ptr< Gcs_xcom_nodes > &&xcom_nodes) override |
Converts the packet into a message that can be delivered to the upper layer. More... | |
void | process_user_data_packet (Gcs_packet &&packet, std::unique_ptr< Gcs_xcom_nodes > &&xcom_nodes) override |
The purpose of this method is to be called when in Gcs_xcom_interface callback method xcom_receive_data is invoked. More... | |
Gcs_protocol_version | get_protocol_version () const override |
Retrieves the current GCS protocol version in use. More... | |
std::pair< bool, std::future< void > > | set_protocol_version (Gcs_protocol_version new_version) override |
Modifies the GCS protocol version in use. More... | |
Gcs_protocol_version | get_maximum_supported_protocol_version () const override |
Get the maximum protocol version currently supported by the group. More... | |
void | set_maximum_supported_protocol_version (Gcs_protocol_version version) |
void | set_communication_protocol (enum_transport_protocol protocol) override |
Sets the communication protocol to use. More... | |
enum_transport_protocol | get_incoming_connections_protocol () override |
Get the incoming connections protocol which is currently active. More... | |
Public Member Functions inherited from Gcs_xcom_communication_interface | |
~Gcs_xcom_communication_interface () override=default | |
Public Member Functions inherited from Gcs_communication_interface | |
virtual | ~Gcs_communication_interface ()=default |
Private Types | |
enum class | packet_recovery_result { OK , PACKETS_UNRECOVERABLE , NO_MEMORY , PIPELINE_ERROR , PIPELINE_UNEXPECTED_OUTPUT , PACKET_UNEXPECTED_CARGO , ERROR } |
Error code for the packet recovery proceess. More... | |
Private Member Functions | |
void | notify_received_message (std::unique_ptr< Gcs_message > &&message) |
Notify upper layers that a message has been received. More... | |
void | deliver_user_data_packet (Gcs_packet &&packet, std::unique_ptr< Gcs_xcom_nodes > &&xcom_nodes) |
Delivers the packet to the upper layer. More... | |
std::vector< Gcs_xcom_node_information > | possible_packet_recovery_donors () const |
packet_recovery_result | recover_packets_from_donor (Gcs_xcom_node_information const &donor, Gcs_xcom_synode_set const &synodes, synode_app_data_array &recovered_data) |
Attempts to recover the packets delivered in synodes from donor . More... | |
packet_recovery_result | process_recovered_packets (synode_app_data_array const &recovered_data) |
Processes all the recovered packets. More... | |
packet_recovery_result | process_recovered_packet (synode_app_data const &recovered_data) |
Processes a single recovered packet. More... | |
void | log_packet_recovery_failure (packet_recovery_result const &error_code, Gcs_xcom_node_information const &donor) const |
Logs the packet recovery failure. More... | |
Gcs_xcom_communication (const Gcs_xcom_communication &) | |
Gcs_xcom_communication & | operator= (const Gcs_xcom_communication &) |
Private Attributes | |
std::map< int, const Gcs_communication_event_listener & > | event_listeners |
Gcs_xcom_statistics_manager_interface * | m_stats |
Gcs_xcom_proxy * | m_xcom_proxy |
Gcs_xcom_view_change_control_interface * | m_view_control |
Gcs_message_pipeline | m_msg_pipeline |
The pipeline of stages a message has to go through before it is delivered to the application or sent to the network. More... | |
std::vector< std::pair< Gcs_packet, std::unique_ptr< Gcs_xcom_nodes > > > | m_buffered_packets |
Buffer that is used to store packets while the node is about to install a view and is running the state exchange phase. More... | |
Gcs_xcom_nodes | m_xcom_nodes |
Most recent XCom membership known. More... | |
unsigned int | m_gid_hash |
Hash of the group. More... | |
Gcs_xcom_communication_protocol_changer | m_protocol_changer |
Protocol changer. More... | |
std::unique_ptr< Network_provider_management_interface > | m_comms_mgmt_interface |
|
strongprivate |
|
explicit |
Gcs_xcom_communication_interface constructor.
[in] | stats | a reference to the statistics interface |
[in] | proxy | a reference to an implementation of Gcs_xcom_communication_proxy |
[in] | view_control | a reference to a gcs_xcom_view_change_control_interface implementation |
[in] | gcs_engine | Pointer to gcs engine |
[in] | group_id | reference to the group identifier |
[in] | comms_mgmt | an unique_ptr to a Network_provider_management_interface |
|
overridedefault |
|
private |
|
overridevirtual |
Registers an implementation of a Gcs_communication_event_listener that will receive Communication Events.
Note that a binding implementation shall not offer the possibility of changing listeners while the system is up and running. In that sense, listeners must be added to it only when booting up the system.
[in] | event_listener | a class that implements Gcs_communication_event_listener |
Implements Gcs_communication_interface.
|
overridevirtual |
Buffer packets when a view is not installed yet and the state exchange phase is being executed.
Note that this method must be executed by the same thread that processes global view messages and data message in order to avoid any concurrency issue.
packet | Packet to buffer. |
xcom_nodes | Membership at the time the packet was received |
Implements Gcs_xcom_communication_interface.
|
overridevirtual |
Implements Gcs_xcom_communication_interface.
|
overridevirtual |
Converts the packet into a message that can be delivered to the upper layer.
packet | The packet to convert |
xcom_nodes | The membership at the time the packet was delivered |
Gcs_message* | if successful |
nullptr | if unsuccessful |
Implements Gcs_xcom_communication_interface.
|
overridevirtual |
The state exchange phase has been executed and the view has been installed so this is used to send any buffered packet to upper layers.
Note that this method must be executed by the same thread that processes global view messages and data message in order to avoid any concurrency issue.
Implements Gcs_xcom_communication_interface.
|
private |
Delivers the packet to the upper layer.
|
overridevirtual |
Sends a message that is internal to the binding implementation.
This message will not be subject to the same restrictions of send_message. As such, it will not observe view safety nor will count for the statistics of messages sent.
[in] | message_to_send | the message to send |
[out] | message_length | the length of message which was send if GCS_OK, unspecified otherwise |
[in] | cargo | internal message header cargo type |
GCS_OK | message is transmitted successfully |
GCS_NOK | error occurred while transmitting message |
GCS_MESSAGE_TOO_BIG | message is bigger then xcom can handle |
Implements Gcs_xcom_communication_interface.
std::map< int, const Gcs_communication_event_listener & > * Gcs_xcom_communication::get_event_listeners | ( | ) |
|
overridevirtual |
Get the incoming connections protocol which is currently active.
Implements Gcs_communication_interface.
|
overridevirtual |
Get the maximum protocol version currently supported by the group.
Implements Gcs_communication_interface.
|
inlineoverridevirtual |
Implements Gcs_xcom_communication_interface.
|
overridevirtual |
Retrieves the current GCS protocol version in use.
Implements Gcs_communication_interface.
|
private |
Logs the packet recovery failure.
|
private |
Notify upper layers that a message has been received.
|
overridevirtual |
Return the number of buffered packets.
Note that this method must be executed by the same thread that processes global view messages and data message in order to avoid any concurrency issue.
Implements Gcs_xcom_communication_interface.
|
private |
|
private |
|
private |
Processes a single recovered packet.
|
private |
Processes all the recovered packets.
|
overridevirtual |
The purpose of this method is to be called when in Gcs_xcom_interface callback method xcom_receive_data is invoked.
This allows, in terms of software architecture, to concentrate all the message delivery logic and processing in a single place.
The deliver_message callback that is registered in XCom (in gcs_xcom_interface.h) and that actually receives the low-level messages, is implemented as a delegator to this method.
Note that the method will be responsible for deleting the message passed as parameter and must be executed by the same thread that processes global view messages and data message in order to avoid any concurrency issue.
Implements Gcs_xcom_communication_interface.
|
overridevirtual |
Attempts to recover the missing packets that are required for a node to join the group successfully.
For example, the missing packets may be some fragments of a message that have already been delivered by XCom to the existing members of the group. The joining node needs those fragments in order to be able to deliver the reassembled message when the final fragments are delivered by XCom.
Note that this method must be executed by the same thread that processes global view messages and data message in order to avoid any concurrency issue.
synodes | The synodes where the required packets were decided |
Implements Gcs_xcom_communication_interface.
|
private |
Attempts to recover the packets delivered in synodes
from donor
.
recovered_data
is an out parameter.
|
overridevirtual |
Removes a previously registered event listener.
Note that a binding implementation shall not offer the possibility of changing listeners while the system is up and running. In that sense listeners must be removed from it only when shutting down the system.
[in] | event_listener_handle | the handle returned when the listener was registered |
Implements Gcs_communication_interface.
|
overridevirtual |
Implementation of the public send_message method defined in Gcs_xcom_communication.
Besides sending a message to the group, this method does two extra things:
[in] | message_to_send | the message to send |
GCS_OK | when message is transmitted successfully |
GCS_NOK | when error occurred while transmitting message |
GCS_MESSAGE_TOO_BIG | when message is bigger then xcom can handle |
Implements Gcs_communication_interface.
|
overridevirtual |
Sets the communication protocol to use.
protocol | the protocol to use |
Implements Gcs_communication_interface.
void Gcs_xcom_communication::set_maximum_supported_protocol_version | ( | Gcs_protocol_version | version | ) |
|
overridevirtual |
Modifies the GCS protocol version in use.
The method is non-blocking. It returns a future on which the caller can wait for the action to finish.
This method has the following requirements:
A GCS client must ensure the requirements are met. In the case of Group Replication, these requirements are ensured by initiating a GCS protocol change as part of a GR group action.
new_version | The desired GCS protocol version |
{true,future} | If successful |
{false,_} | If unsuccessful because new_version is unsupported |
Implements Gcs_communication_interface.
|
overridevirtual |
Notify the pipeline about the new XCom membership when a state exchange begins.
Note that this method must be executed by the same thread that processes global view messages and data message in order to avoid any concurrency issue.
me | The identifier of this server |
members | The XCom membership |
Implements Gcs_xcom_communication_interface.
|
private |
|
private |
Buffer that is used to store packets while the node is about to install a view and is running the state exchange phase.
|
private |
|
private |
Hash of the group.
|
private |
The pipeline of stages a message has to go through before it is delivered to the application or sent to the network.
|
private |
Protocol changer.
|
private |
|
private |
|
private |
Most recent XCom membership known.
|
private |