24#ifndef GCS_XCOM_CONTROL_INTERFACE_INCLUDED
25#define GCS_XCOM_CONTROL_INTERFACE_INCLUDED
58#include "plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp.h"
110 std::vector<Gcs_member_identifier *> alive_nodes,
111 std::vector<Gcs_member_identifier *> left_nodes,
112 std::vector<Gcs_member_identifier *> member_suspect_nodes,
113 std::vector<Gcs_member_identifier *> non_member_suspect_nodes,
262 std::vector<Gcs_member_identifier *> non_member_suspect_nodes,
263 std::vector<Gcs_member_identifier *> member_suspect_nodes,
395 std::vector<Gcs_xcom_node_address *> &xcom_peers,
402 std::unique_ptr<Network_provider_operations_interface>
403 comms_operation_interface);
468 bool do_not_deliver_to_client,
546 void set_peer_nodes(std::vector<Gcs_xcom_node_address *> &xcom_peers);
580 unsigned int join_sleep_time);
608 std::vector<Gcs_member_identifier *> &alive_members,
609 std::vector<Gcs_member_identifier *> &failed_members);
612 std::vector<Gcs_member_identifier *> &left_members,
613 std::vector<Gcs_member_identifier *> &alive_members,
614 std::vector<Gcs_member_identifier *> &failed_members,
615 const std::vector<Gcs_member_identifier> *current_members);
618 std::vector<Gcs_member_identifier *> &joined_members,
619 std::vector<Gcs_member_identifier *> &alive_members,
620 const std::vector<Gcs_member_identifier> *current_members);
623 std::vector<Gcs_member_identifier *> &member_suspect_nodes,
624 std::vector<Gcs_member_identifier *> &failed_members,
625 const std::vector<Gcs_member_identifier> *current_members);
628 std::vector<Gcs_member_identifier *> &non_member_suspect_nodes,
629 std::vector<Gcs_member_identifier *> &failed_members,
630 const std::vector<Gcs_member_identifier> *current_members);
642 const std::vector<Gcs_member_identifier *> &alive_members)
const;
652 std::vector<Gcs_member_identifier> *to_fill);
669 std::map<Gcs_member_identifier, Xcom_member_state *> *states,
670 std::set<Gcs_member_identifier *> *
total,
671 std::set<Gcs_member_identifier *> *left,
672 std::set<Gcs_member_identifier *> *
join,
691 std::vector<Gcs_xcom_node_address *> *peers_list);
715 std::map<std::string, int>
const &my_addresses);
728 std::map<std::string, int>
const &my_addresses);
736 std::vector<Gcs_xcom_node_information>
const &incompatible_members);
786 std::unique_ptr<Network_provider_operations_interface>
This interface is implemented by those who wish to receive Control Interface notifications.
Definition: gcs_control_event_listener.h:52
This interface represents all the control functionalities that a binding implementation must provide.
Definition: gcs_control_interface.h:111
This represents the unique identification of a group.
Definition: gcs_group_identifier.h:35
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
Class that represents the data that is exchanged within a group.
Definition: gcs_message.h:357
Interface to decouple XCom sock_probe implementation to allow unit testing.
Definition: gcs_xcom_networking.h:42
This class stores all node suspicions, as well as the timeout and period parameters used by the threa...
Definition: gcs_xcom_control_interface.h:69
void clear_suspicions()
Clear all suspicions.
Definition: gcs_xcom_control_interface.cc:1970
void set_groupid_hash(unsigned int gid_h)
Sets the hash for the current group identifier.
Definition: gcs_xcom_control_interface.cc:2304
uint64_t get_non_member_expel_timeout()
Retrieves non-member expel timeout in 100s of nanoseconds.
Definition: gcs_xcom_control_interface.cc:2269
My_xp_mutex_impl m_suspicions_parameters_mutex
Definition: gcs_xcom_control_interface.h:314
~Gcs_suspicions_manager()
Destructor for Gcs_suspicions_manager.
Definition: gcs_xcom_control_interface.cc:1946
void inform_on_majority(bool majority)
Auxiliary method to inform the suspicions manager that this node is in a group with the majority of t...
Definition: gcs_xcom_control_interface.cc:2333
Gcs_suspicions_manager & operator=(Gcs_suspicions_manager const &)
Gcs_xcom_nodes m_suspicions
Definition: gcs_xcom_control_interface.h:299
void remove_suspicions(std::vector< Gcs_member_identifier * > nodes)
Invoked by Gcs_suspicions_manager::process_view, it verifies if any of the nodes in the received list...
Definition: gcs_xcom_control_interface.cc:1952
const Gcs_xcom_nodes & get_suspicions() const
Retrieves current list of suspicions.
Definition: gcs_xcom_control_interface.cc:2308
bool m_has_majority
Definition: gcs_xcom_control_interface.h:329
void set_member_expel_timeout_seconds(unsigned long sec)
Sets the time interval to wait before removing member nodes marked to be expelled from the cluster.
Definition: gcs_xcom_control_interface.cc:2295
void process_view(synode_no const config_id, Gcs_xcom_nodes *xcom_nodes, std::vector< Gcs_member_identifier * > alive_nodes, std::vector< Gcs_member_identifier * > left_nodes, std::vector< Gcs_member_identifier * > member_suspect_nodes, std::vector< Gcs_member_identifier * > non_member_suspect_nodes, bool is_killer_node, synode_no max_synode)
Invoked by Gcs_xcom_control::xcom_receive_global_view, it invokes the remove_suspicions method for th...
Definition: gcs_xcom_control_interface.cc:1987
bool has_majority()
Auxiliary method to retrieve if the suspicions manager has the majority enabled.
Definition: gcs_xcom_control_interface.cc:2339
Gcs_xcom_expels_in_progress m_expels_in_progress
Definition: gcs_xcom_control_interface.h:342
synode_no m_cache_last_removed
Definition: gcs_xcom_control_interface.h:337
void set_my_info(Gcs_xcom_node_information *node_info)
Sets the information for this node.
Definition: gcs_xcom_control_interface.cc:2329
void set_non_member_expel_timeout_seconds(unsigned long sec)
Sets the time interval to wait before removing non-member nodes marked to be expelled from the cluste...
Definition: gcs_xcom_control_interface.cc:2278
synode_no m_config_id
Definition: gcs_xcom_control_interface.h:347
void process_suspicions()
Invoked periodically by the suspicions processing thread, it picks a timestamp and verifies which sus...
Definition: gcs_xcom_control_interface.cc:2120
Gcs_xcom_proxy * m_proxy
Definition: gcs_xcom_control_interface.h:269
Gcs_suspicions_manager(Gcs_xcom_proxy *proxy, Gcs_xcom_control *ctrl)
Constructor for Gcs_suspicions_manager, which sets m_proxy with the received pointer parameter.
Definition: gcs_xcom_control_interface.cc:1924
uint64_t m_non_member_expel_timeout
Definition: gcs_xcom_control_interface.h:284
Gcs_suspicions_manager(Gcs_suspicions_manager const &)
Gcs_xcom_control * m_control_if
Definition: gcs_xcom_control_interface.h:274
My_xp_mutex_impl m_suspicions_mutex
Definition: gcs_xcom_control_interface.h:304
uint64_t m_member_expel_timeout
Definition: gcs_xcom_control_interface.h:289
unsigned int get_suspicions_processing_period()
Retrieves suspicion thread period in seconds.
Definition: gcs_xcom_control_interface.cc:2252
void set_suspicions_processing_period(unsigned int sec)
Sets the period or sleep time, between iterations, for the suspicion thread.
Definition: gcs_xcom_control_interface.cc:2260
My_xp_cond_impl m_suspicions_cond
Definition: gcs_xcom_control_interface.h:309
unsigned int m_gid_hash
Definition: gcs_xcom_control_interface.h:294
bool add_suspicions(Gcs_xcom_nodes *xcom_nodes, std::vector< Gcs_member_identifier * > non_member_suspect_nodes, std::vector< Gcs_member_identifier * > member_suspect_nodes, synode_no max_synode)
Invoked by Gcs_suspicions_manager::process_view, it adds suspicions for the nodes received as argumen...
Definition: gcs_xcom_control_interface.cc:2060
unsigned int m_suspicions_processing_period
Definition: gcs_xcom_control_interface.h:279
uint64_t get_member_expel_timeout()
Retrieves member expel timeout in 100s of nanoseconds.
Definition: gcs_xcom_control_interface.cc:2287
Gcs_xcom_node_information * m_my_info
Definition: gcs_xcom_control_interface.h:324
void update_last_removed(synode_no last_removed)
Definition: gcs_xcom_control_interface.cc:2347
void run_process_suspicions(bool lock)
Invoked periodically by the suspicions processing thread, it picks a timestamp and verifies which sus...
Definition: gcs_xcom_control_interface.cc:2149
void wake_suspicions_processing_thread(bool terminate)
Auxiliary method to wake the suspicions processing thread and set if it should terminate or not.
Definition: gcs_xcom_control_interface.cc:2312
bool m_is_killer_node
Definition: gcs_xcom_control_interface.h:319
This represents the membership view that a member has from a group.
Definition: gcs_view.h:55
Gcs_view_error_code
Define error codes associated to the view.
Definition: gcs_view.h:60
@ OK
Definition: gcs_view.h:60
Definition: gcs_xcom_control_interface.h:369
Gcs_xcom_node_information const & get_node_information() const
Definition: gcs_xcom_control_interface.cc:189
bool m_leave_view_requested
Definition: gcs_xcom_control_interface.h:803
enum_gcs_error leave() override
Method that causes one to leave the group that this interface pertains.
Definition: gcs_xcom_control_interface.cc:651
Gcs_xcom_proxy * m_xcom_proxy
Definition: gcs_xcom_control_interface.h:743
void install_leave_view(Gcs_view::Gcs_view_error_code error_code)
Notify that the current member has left the group and whether it left gracefully or not.
Definition: gcs_xcom_control_interface.cc:1306
bool m_boot
Definition: gcs_xcom_control_interface.h:812
static constexpr int CONNECTION_ATTEMPTS
Definition: gcs_xcom_control_interface.h:371
Gcs_suspicions_manager * m_suspicions_manager
Definition: gcs_xcom_control_interface.h:778
My_xp_socket_util * m_socket_util
Definition: gcs_xcom_control_interface.h:764
void build_member_list(std::set< Gcs_member_identifier * > *origin, std::vector< Gcs_member_identifier > *to_fill)
Copies from a set to a vector of Gcs_member_identifier.
Definition: gcs_xcom_control_interface.cc:1849
Gcs_xcom_node_address * get_node_address()
Return the address associated with the current node.
Definition: gcs_xcom_control_interface.cc:185
Gcs_xcom_control(Gcs_xcom_node_address *xcom_node_address, std::vector< Gcs_xcom_node_address * > &xcom_peers, Gcs_group_identifier group_identifier, Gcs_xcom_proxy *xcom_proxy, Gcs_xcom_group_management *xcom_group_management, Gcs_xcom_engine *gcs_engine, Gcs_xcom_state_exchange_interface *state_exchange, Gcs_xcom_view_change_control_interface *view_control, bool boot, My_xp_socket_util *socket_util, std::unique_ptr< Network_provider_operations_interface > comms_operation_interface)
Gcs_xcom_control_interface constructor.
Definition: gcs_xcom_control_interface.cc:119
void set_join_behavior(unsigned int join_attempts, unsigned int join_sleep_time)
Definition: gcs_xcom_control_interface.cc:211
My_xp_socket_util * get_socket_util()
Return a pointer to a socket utility.
Definition: gcs_xcom_control_interface.cc:204
bool xcom_receive_local_view(synode_no const config_id, Gcs_xcom_nodes *xcom_nodes, synode_no max_synode)
Definition: gcs_xcom_control_interface.cc:1125
void process_control_message(Gcs_message *msg, Gcs_protocol_version maximum_supported_protocol_version, Gcs_protocol_version used_protocol_version)
Process a message from the control interface and if necessary delegate it to the state exchange.
Definition: gcs_xcom_control_interface.cc:1633
enum_gcs_error do_leave()
Definition: gcs_xcom_control_interface.cc:691
void remove_event_listener(int event_listener_handle) override
Removes a previously registered event listener.
Definition: gcs_xcom_control_interface.cc:941
void clear_peer_nodes()
Deletes all the Gcs_xcom_node_address objects pointed by the elements of the m_initial_peers vector,...
Definition: gcs_xcom_control_interface.cc:1894
void wait_for_xcom_thread()
This member function can be used to wait until xcom thread exits.
Definition: gcs_xcom_control_interface.cc:207
bool xcom_receive_leave()
const Gcs_member_identifier get_local_member_identifier() const override
Retrieves the local identifier of this member on a group.
Definition: gcs_xcom_control_interface.cc:924
bool xcom_receive_global_view(synode_no const config_id, synode_no message_id, Gcs_xcom_nodes *xcom_nodes, bool do_not_deliver_to_client, synode_no max_synode)
The purpose of this method is to be called when in Gcs_xcom_interface callback method of View Changin...
Definition: gcs_xcom_control_interface.cc:1367
void build_non_member_suspect_nodes(std::vector< Gcs_member_identifier * > &non_member_suspect_nodes, std::vector< Gcs_member_identifier * > &failed_members, const std::vector< Gcs_member_identifier > *current_members)
Definition: gcs_xcom_control_interface.cc:1078
void init_me()
Definition: gcs_xcom_control_interface.cc:1861
Gcs_xcom_control & operator=(const Gcs_xcom_control &)
void build_total_members(Gcs_xcom_nodes *xcom_nodes, std::vector< Gcs_member_identifier * > &alive_members, std::vector< Gcs_member_identifier * > &failed_members)
Definition: gcs_xcom_control_interface.cc:956
void build_left_members(std::vector< Gcs_member_identifier * > &left_members, std::vector< Gcs_member_identifier * > &alive_members, std::vector< Gcs_member_identifier * > &failed_members, const std::vector< Gcs_member_identifier > *current_members)
Definition: gcs_xcom_control_interface.cc:1009
bool send_add_node_request(std::map< std::string, int > const &my_addresses)
Attempts to send an add_node request to some initial peer from m_initial_peers.
Definition: gcs_xcom_control_interface.cc:538
unsigned int m_join_attempts
Definition: gcs_xcom_control_interface.h:770
std::vector< Gcs_xcom_node_address * > m_initial_peers
Definition: gcs_xcom_control_interface.h:815
void do_leave_view()
Sends a leave view message to informat that XCOM has already exited or is about to do so.
Definition: gcs_xcom_control_interface.cc:745
bool is_this_node_in(std::vector< Gcs_member_identifier * > *members)
Check whether the current member is in the received vector of members.
Definition: gcs_xcom_control_interface.cc:1353
Gcs_xcom_engine * m_gcs_engine
Definition: gcs_xcom_control_interface.h:821
connection_descriptor * get_connection_to_node(std::vector< Gcs_xcom_node_address * > *peers_list)
Cycle through peers_list and try to open a connection to the peer, if it isn't the node itself.
Definition: gcs_xcom_control_interface.cc:766
unsigned int m_join_sleep_time
Definition: gcs_xcom_control_interface.h:775
std::unique_ptr< Network_provider_operations_interface > m_comms_operation_interface
Definition: gcs_xcom_control_interface.h:787
bool is_killer_node(const std::vector< Gcs_member_identifier * > &alive_members) const
Decides if this node shall be the one to kill failed nodes.
Definition: gcs_xcom_control_interface.cc:1110
bool is_xcom_running()
Whether XCOM's Thread is running or not.
Definition: gcs_xcom_control_interface.cc:209
Gcs_xcom_group_management * m_xcom_group_management
Definition: gcs_xcom_control_interface.h:746
Gcs_xcom_node_information * m_local_node_info
Definition: gcs_xcom_control_interface.h:752
void expel_incompatible_members(std::vector< Gcs_xcom_node_information > const &incompatible_members)
Expel the given members from XCom.
Definition: gcs_xcom_control_interface.cc:1904
My_xp_thread_impl m_xcom_thread
Definition: gcs_xcom_control_interface.h:761
void set_peer_nodes(std::vector< Gcs_xcom_node_address * > &xcom_peers)
Inserts in m_initial_peers copies of the Gcs_xcom_node_address objects whose addresses are in the xco...
Definition: gcs_xcom_control_interface.cc:1883
void set_node_address(Gcs_xcom_node_address *node_address)
Set the address associated with the current node.
Definition: gcs_xcom_control_interface.cc:1866
Gcs_xcom_proxy * get_xcom_proxy()
Return a pointer to the proxy object used to access XCOM.
Definition: gcs_xcom_control_interface.cc:194
void do_remove_node_from_group()
Request other members to remove node from the group.
Definition: gcs_xcom_control_interface.cc:814
Gcs_suspicions_manager * get_suspicions_manager()
Definition: gcs_xcom_control_interface.cc:196
Gcs_sock_probe_interface * m_sock_probe_interface
Definition: gcs_xcom_control_interface.h:784
enum_gcs_error retry_do_join()
Definition: gcs_xcom_control_interface.cc:371
bool m_leave_view_delivered
Definition: gcs_xcom_control_interface.h:809
void install_view(Gcs_xcom_view_identifier *new_view_id, const Gcs_group_identifier &group_id, std::map< Gcs_member_identifier, Xcom_member_state * > *states, std::set< Gcs_member_identifier * > *total, std::set< Gcs_member_identifier * > *left, std::set< Gcs_member_identifier * > *join, Gcs_view::Gcs_view_error_code error_code=Gcs_view::OK)
Makes all the necessary arrangements to install a new view in the binding and in all registered clien...
Definition: gcs_xcom_control_interface.cc:1758
bool m_xcom_running
Definition: gcs_xcom_control_interface.h:798
int add_event_listener(const Gcs_control_event_listener &event_listener) override
Registers an implementation of a Gcs_control_event_listener that will receive Control Events.
Definition: gcs_xcom_control_interface.cc:929
std::map< int, const Gcs_control_event_listener & > event_listeners
Definition: gcs_xcom_control_interface.h:749
unsigned int m_gid_hash
Definition: gcs_xcom_control_interface.h:740
void build_member_suspect_nodes(std::vector< Gcs_member_identifier * > &member_suspect_nodes, std::vector< Gcs_member_identifier * > &failed_members, const std::vector< Gcs_member_identifier > *current_members)
Definition: gcs_xcom_control_interface.cc:1046
std::map< int, const Gcs_control_event_listener & > * get_event_listeners()
Definition: gcs_xcom_control_interface.cc:114
std::pair< bool, connection_descriptor * > connect_to_peer(Gcs_xcom_node_address &peer, std::map< std::string, int > const &my_addresses)
Connects to the given peer's XCom.
Definition: gcs_xcom_control_interface.cc:607
void set_boot_node(bool boot)
Definition: gcs_xcom_control_interface.cc:202
~Gcs_xcom_control() override
Definition: gcs_xcom_control_interface.cc:173
Gcs_xcom_control(const Gcs_xcom_control &)
enum_gcs_error do_join(const bool retry=true)
Definition: gcs_xcom_control_interface.cc:282
Gcs_xcom_node_address * m_local_node_address
Definition: gcs_xcom_control_interface.h:755
bool try_send_add_node_request_to_seeds(std::map< std::string, int > const &my_addresses)
Attempts to send an add_node request to some initial peer from m_initial_peers.
Definition: gcs_xcom_control_interface.cc:552
enum_gcs_error join() override
Method that causes one to join the group that this interface pertains.
Definition: gcs_xcom_control_interface.cc:235
Gcs_xcom_view_change_control_interface * m_view_control
Definition: gcs_xcom_control_interface.h:818
enum_gcs_error set_xcom_cache_size(uint64_t size) override
Sets a new value for the maximum size of the XCom cache.
Definition: gcs_xcom_control_interface.cc:222
Gcs_xcom_state_exchange_interface * m_state_exchange
Definition: gcs_xcom_control_interface.h:758
bool belongs_to_group() override
Reports if one has joined and belongs to a group.
Definition: gcs_xcom_control_interface.cc:916
Gcs_view * get_current_view() override
Returns the currently installed view.
Definition: gcs_xcom_control_interface.cc:920
Gcs_group_identifier * m_gid
Definition: gcs_xcom_control_interface.h:739
void build_joined_members(std::vector< Gcs_member_identifier * > &joined_members, std::vector< Gcs_member_identifier * > &alive_members, const std::vector< Gcs_member_identifier > *current_members)
Definition: gcs_xcom_control_interface.cc:981
My_xp_thread_impl m_suspicions_processing_thread
Definition: gcs_xcom_control_interface.h:781
Definition: gcs_xcom_notification.h:94
The set of expels we have issued but that have not yet taken effect.
Definition: gcs_xcom_expels_in_progress.h:56
Definition: gcs_xcom_group_management.h:37
Stores connection information associated with a node.
Definition: gcs_xcom_group_member_information.h:51
This class contains information on the configuration, i.e set of nodes or simply site definition.
Definition: gcs_xcom_group_member_information.h:391
Definition: gcs_xcom_proxy.h:52
Definition: gcs_xcom_state_exchange.h:370
Definition: gcs_xcom_state_exchange.h:716
Definition: gcs_xcom_view_identifier.h:33
Definition: my_xp_cond.h:136
Definition: my_xp_mutex.h:123
Interface for socket utility methods.
Definition: my_xp_util.h:154
Definition: my_xp_thread.h:139
static struct my_cs_file_section_st sec[]
Definition: ctype.cc:162
enum_gcs_error
This enumeration describes errors which can occur during group communication operations.
Definition: gcs_types.h:41
Gcs_protocol_version
The GCS protocol versions.
Definition: gcs_types.h:128
static Gcs_xcom_engine * gcs_engine
Definition: gcs_xcom_interface.cc:144
Type total(const Shards< COUNT > &shards) noexcept
Get the total value of all shards.
Definition: ut0counter.h:333
bool terminate(THD *thd)
Drop all DD tables in case there is an error while upgrading server.
Definition: upgrade.cc:686
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
Definition: node_connection.h:47
Rudimentary task system in portable C, based on Tom Duff's switch-based coroutine trick and a stack o...
static task_env * retry
Definition: xcom_base.cc:436
task_env * boot
Definition: xcom_base.cc:407
static int majority(bit_set const *nodeset, site_def const *s, int all, int delay, int force)
Definition: xcom_base.cc:781
synode_no max_synode
Definition: xcom_base.cc:406