24#ifndef GCS_XCOM_CONTROL_INTERFACE_INCLUDED
25#define GCS_XCOM_CONTROL_INTERFACE_INCLUDED
59#include "plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp.h"
111 std::vector<Gcs_member_identifier *> alive_nodes,
112 std::vector<Gcs_member_identifier *> left_nodes,
113 std::vector<Gcs_member_identifier *> member_suspect_nodes,
114 std::vector<Gcs_member_identifier *> non_member_suspect_nodes,
263 std::vector<Gcs_member_identifier *> non_member_suspect_nodes,
264 std::vector<Gcs_member_identifier *> member_suspect_nodes,
397 std::vector<Gcs_xcom_node_address *> &xcom_peers,
404 std::unique_ptr<Network_provider_operations_interface>
405 comms_operation_interface,
471 bool do_not_deliver_to_client,
549 void set_peer_nodes(std::vector<Gcs_xcom_node_address *> &xcom_peers);
583 unsigned int join_sleep_time);
611 std::vector<Gcs_member_identifier *> &alive_members,
612 std::vector<Gcs_member_identifier *> &failed_members);
615 std::vector<Gcs_member_identifier *> &left_members,
616 std::vector<Gcs_member_identifier *> &alive_members,
617 std::vector<Gcs_member_identifier *> &failed_members,
618 const std::vector<Gcs_member_identifier> *current_members);
621 std::vector<Gcs_member_identifier *> &joined_members,
622 std::vector<Gcs_member_identifier *> &alive_members,
623 const std::vector<Gcs_member_identifier> *current_members);
626 std::vector<Gcs_member_identifier *> &member_suspect_nodes,
627 std::vector<Gcs_member_identifier *> &failed_members,
628 const std::vector<Gcs_member_identifier> *current_members);
631 std::vector<Gcs_member_identifier *> &non_member_suspect_nodes,
632 std::vector<Gcs_member_identifier *> &failed_members,
633 const std::vector<Gcs_member_identifier> *current_members);
645 const std::vector<Gcs_member_identifier *> &alive_members)
const;
655 std::vector<Gcs_member_identifier> *to_fill);
672 std::map<Gcs_member_identifier, Xcom_member_state *> *states,
673 std::set<Gcs_member_identifier *> *
total,
674 std::set<Gcs_member_identifier *> *left,
675 std::set<Gcs_member_identifier *> *
join,
694 std::vector<Gcs_xcom_node_address *> *peers_list);
718 std::map<std::string, int>
const &my_addresses);
731 std::map<std::string, int>
const &my_addresses);
739 std::vector<Gcs_xcom_node_information>
const &incompatible_members);
789 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:70
void clear_suspicions()
Clear all suspicions.
Definition: gcs_xcom_control_interface.cc:1977
void set_groupid_hash(unsigned int gid_h)
Sets the hash for the current group identifier.
Definition: gcs_xcom_control_interface.cc:2311
uint64_t get_non_member_expel_timeout()
Retrieves non-member expel timeout in 100s of nanoseconds.
Definition: gcs_xcom_control_interface.cc:2276
My_xp_mutex_impl m_suspicions_parameters_mutex
Definition: gcs_xcom_control_interface.h:315
~Gcs_suspicions_manager()
Destructor for Gcs_suspicions_manager.
Definition: gcs_xcom_control_interface.cc:1953
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:2340
Gcs_suspicions_manager & operator=(Gcs_suspicions_manager const &)
Gcs_xcom_nodes m_suspicions
Definition: gcs_xcom_control_interface.h:300
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:1959
const Gcs_xcom_nodes & get_suspicions() const
Retrieves current list of suspicions.
Definition: gcs_xcom_control_interface.cc:2315
bool m_has_majority
Definition: gcs_xcom_control_interface.h:330
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:2302
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:1994
bool has_majority()
Auxiliary method to retrieve if the suspicions manager has the majority enabled.
Definition: gcs_xcom_control_interface.cc:2346
Gcs_xcom_expels_in_progress m_expels_in_progress
Definition: gcs_xcom_control_interface.h:343
synode_no m_cache_last_removed
Definition: gcs_xcom_control_interface.h:338
void set_my_info(Gcs_xcom_node_information *node_info)
Sets the information for this node.
Definition: gcs_xcom_control_interface.cc:2336
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:2285
synode_no m_config_id
Definition: gcs_xcom_control_interface.h:348
void process_suspicions()
Invoked periodically by the suspicions processing thread, it picks a timestamp and verifies which sus...
Definition: gcs_xcom_control_interface.cc:2127
Gcs_xcom_proxy * m_proxy
Definition: gcs_xcom_control_interface.h:270
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:1931
uint64_t m_non_member_expel_timeout
Definition: gcs_xcom_control_interface.h:285
Gcs_suspicions_manager(Gcs_suspicions_manager const &)
Gcs_xcom_control * m_control_if
Definition: gcs_xcom_control_interface.h:275
My_xp_mutex_impl m_suspicions_mutex
Definition: gcs_xcom_control_interface.h:305
uint64_t m_member_expel_timeout
Definition: gcs_xcom_control_interface.h:290
unsigned int get_suspicions_processing_period()
Retrieves suspicion thread period in seconds.
Definition: gcs_xcom_control_interface.cc:2259
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:2267
My_xp_cond_impl m_suspicions_cond
Definition: gcs_xcom_control_interface.h:310
unsigned int m_gid_hash
Definition: gcs_xcom_control_interface.h:295
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:2067
unsigned int m_suspicions_processing_period
Definition: gcs_xcom_control_interface.h:280
uint64_t get_member_expel_timeout()
Retrieves member expel timeout in 100s of nanoseconds.
Definition: gcs_xcom_control_interface.cc:2294
Gcs_xcom_node_information * m_my_info
Definition: gcs_xcom_control_interface.h:325
void update_last_removed(synode_no last_removed)
Definition: gcs_xcom_control_interface.cc:2354
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:2156
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:2319
bool m_is_killer_node
Definition: gcs_xcom_control_interface.h:320
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:370
Gcs_xcom_node_information const & get_node_information() const
Definition: gcs_xcom_control_interface.cc:191
bool m_leave_view_requested
Definition: gcs_xcom_control_interface.h:809
enum_gcs_error leave() override
Method that causes one to leave the group that this interface pertains.
Definition: gcs_xcom_control_interface.cc:653
Gcs_xcom_proxy * m_xcom_proxy
Definition: gcs_xcom_control_interface.h:746
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:1313
bool m_boot
Definition: gcs_xcom_control_interface.h:818
static constexpr int CONNECTION_ATTEMPTS
Definition: gcs_xcom_control_interface.h:372
Gcs_suspicions_manager * m_suspicions_manager
Definition: gcs_xcom_control_interface.h:781
My_xp_socket_util * m_socket_util
Definition: gcs_xcom_control_interface.h:767
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:1856
Gcs_xcom_node_address * get_node_address()
Return the address associated with the current node.
Definition: gcs_xcom_control_interface.cc:187
void set_join_behavior(unsigned int join_attempts, unsigned int join_sleep_time)
Definition: gcs_xcom_control_interface.cc:213
My_xp_socket_util * get_socket_util()
Return a pointer to a socket utility.
Definition: gcs_xcom_control_interface.cc:206
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:1127
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:1640
enum_gcs_error do_leave()
Definition: gcs_xcom_control_interface.cc:693
void remove_event_listener(int event_listener_handle) override
Removes a previously registered event listener.
Definition: gcs_xcom_control_interface.cc:943
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:1901
void wait_for_xcom_thread()
This member function can be used to wait until xcom thread exits.
Definition: gcs_xcom_control_interface.cc:209
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:926
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:1374
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:1080
void init_me()
Definition: gcs_xcom_control_interface.cc:1868
Gcs_xcom_control & operator=(const Gcs_xcom_control &)
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_statistics_manager_interface *stats_mgr)
Gcs_xcom_control_interface constructor.
Definition: gcs_xcom_control_interface.cc:119
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:958
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:1011
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:540
unsigned int m_join_attempts
Definition: gcs_xcom_control_interface.h:773
std::vector< Gcs_xcom_node_address * > m_initial_peers
Definition: gcs_xcom_control_interface.h:821
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:747
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:1360
Gcs_xcom_engine * m_gcs_engine
Definition: gcs_xcom_control_interface.h:827
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:768
unsigned int m_join_sleep_time
Definition: gcs_xcom_control_interface.h:778
std::unique_ptr< Network_provider_operations_interface > m_comms_operation_interface
Definition: gcs_xcom_control_interface.h:790
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:1112
bool is_xcom_running()
Whether XCOM's Thread is running or not.
Definition: gcs_xcom_control_interface.cc:211
Gcs_xcom_group_management * m_xcom_group_management
Definition: gcs_xcom_control_interface.h:749
Gcs_xcom_node_information * m_local_node_info
Definition: gcs_xcom_control_interface.h:755
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:1911
My_xp_thread_impl m_xcom_thread
Definition: gcs_xcom_control_interface.h:764
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:1890
void set_node_address(Gcs_xcom_node_address *node_address)
Set the address associated with the current node.
Definition: gcs_xcom_control_interface.cc:1873
Gcs_xcom_proxy * get_xcom_proxy()
Return a pointer to the proxy object used to access XCOM.
Definition: gcs_xcom_control_interface.cc:196
void do_remove_node_from_group()
Request other members to remove node from the group.
Definition: gcs_xcom_control_interface.cc:816
Gcs_suspicions_manager * get_suspicions_manager()
Definition: gcs_xcom_control_interface.cc:198
Gcs_sock_probe_interface * m_sock_probe_interface
Definition: gcs_xcom_control_interface.h:787
enum_gcs_error retry_do_join()
Definition: gcs_xcom_control_interface.cc:373
bool m_leave_view_delivered
Definition: gcs_xcom_control_interface.h:815
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:1765
bool m_xcom_running
Definition: gcs_xcom_control_interface.h:804
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:931
std::map< int, const Gcs_control_event_listener & > event_listeners
Definition: gcs_xcom_control_interface.h:752
unsigned int m_gid_hash
Definition: gcs_xcom_control_interface.h:743
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:1048
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:609
void set_boot_node(bool boot)
Definition: gcs_xcom_control_interface.cc:204
~Gcs_xcom_control() override
Definition: gcs_xcom_control_interface.cc:175
Gcs_xcom_control(const Gcs_xcom_control &)
Gcs_xcom_statistics_manager_interface * m_stats_mgr
Definition: gcs_xcom_control_interface.h:793
enum_gcs_error do_join(const bool retry=true)
Definition: gcs_xcom_control_interface.cc:284
Gcs_xcom_node_address * m_local_node_address
Definition: gcs_xcom_control_interface.h:758
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:554
enum_gcs_error join() override
Method that causes one to join the group that this interface pertains.
Definition: gcs_xcom_control_interface.cc:237
Gcs_xcom_view_change_control_interface * m_view_control
Definition: gcs_xcom_control_interface.h:824
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:224
Gcs_xcom_state_exchange_interface * m_state_exchange
Definition: gcs_xcom_control_interface.h:761
bool belongs_to_group() override
Reports if one has joined and belongs to a group.
Definition: gcs_xcom_control_interface.cc:918
Gcs_view * get_current_view() override
Returns the currently installed view.
Definition: gcs_xcom_control_interface.cc:922
Gcs_group_identifier * m_gid
Definition: gcs_xcom_control_interface.h:742
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:983
My_xp_thread_impl m_suspicions_processing_thread
Definition: gcs_xcom_control_interface.h:784
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:53
Definition: gcs_xcom_state_exchange.h:370
This class is the storage and provider of all statistics coming from either XCom and GCS.
Definition: gcs_xcom_statistics_manager.h:65
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:172
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
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
size_t size(const char *const c)
Definition: base64.h:46
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