MySQL  8.0.22
Source Code Documentation
gcs_xcom_control_interface.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2020, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef GCS_XCOM_CONTROL_INTERFACE_INCLUDED
24 #define GCS_XCOM_CONTROL_INTERFACE_INCLUDED
25 
26 #include <cstdlib>
27 #include <cstring>
28 #include <map>
29 #include <set>
30 
56 #include "plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp.h"
57 
58 class Gcs_xcom_control;
59 
60 /**
61  @class Gcs_suspicions_manager
62 
63  This class stores all node suspicions, as well as the timeout and period
64  parameters used by the thread that processes the suspicions.
65  Suspicions are added and removed upon reception of a new global view.
66 */
68  public:
69  /**
70  Constructor for Gcs_suspicions_manager, which sets m_proxy with the
71  received pointer parameter.
72  @param[in] proxy Pointer to Gcs_xcom_proxy
73  @param[in] ctrl Pointer to Gcs_xcom_control
74  */
75 
76  explicit Gcs_suspicions_manager(Gcs_xcom_proxy *proxy,
77  Gcs_xcom_control *ctrl);
78 
79  /**
80  Destructor for Gcs_suspicions_manager.
81  */
82 
84 
85  /**
86  Invoked by Gcs_xcom_control::xcom_receive_global_view, it invokes the
87  remove_suspicions method for the alive_nodes and left_nodes parameters,
88  if they're not empty, neither m_suspicions. It also invokes the
89  add_suspicions method if the non_member_suspect_nodes and
90  member_suspect_nodes parameter aren't empty.
91 
92  @param[in] config_id Configuration ID of the subsequent node information
93  @param[in] xcom_nodes List of all nodes (i.e. alive or dead) with low level
94  information such as timestamp, unique identifier, etc
95  @param[in] alive_nodes List of the nodes that currently belong to the group
96  @param[in] left_nodes List of the nodes that have left the group
97  @param[in] non_member_suspect_nodes List of joining nodes to add to
98  m_suspicions
99  @param[in] member_suspect_nodes List of previously active nodes to add to
100  m_suspicions
101  @param[in] is_killer_node Indicates if node should remove suspect members
102  from the group
103  @param[in] max_synode XCom max synode
104  */
105 
106  void process_view(
107  synode_no const config_id, Gcs_xcom_nodes *xcom_nodes,
108  std::vector<Gcs_member_identifier *> alive_nodes,
109  std::vector<Gcs_member_identifier *> left_nodes,
110  std::vector<Gcs_member_identifier *> member_suspect_nodes,
111  std::vector<Gcs_member_identifier *> non_member_suspect_nodes,
112  bool is_killer_node, synode_no max_synode);
113 
114  /**
115  Invoked periodically by the suspicions processing thread, it picks a
116  timestamp and verifies which suspect nodes should be removed as they
117  have timed out.
118  */
119 
120  void process_suspicions();
121 
122  /**
123  Clear all suspicions. Invoked when node is leaving the group.
124  */
125 
126  void clear_suspicions();
127 
128  /**
129  Invoked periodically by the suspicions processing thread, it picks a
130  timestamp and verifies which suspect nodes should be removed as they
131  have timed out.
132 
133  @param[in] lock Whether lock should be acquired or not
134  */
135 
136  void run_process_suspicions(bool lock);
137 
138  /**
139  Retrieves current list of suspicions.
140  */
141 
142  const Gcs_xcom_nodes &get_suspicions() const;
143 
144  /**
145  Retrieves suspicion thread period in seconds.
146  */
147 
148  unsigned int get_suspicions_processing_period();
149 
150  /**
151  Sets the period or sleep time, between iterations, for the suspicion
152  thread.
153  @param[in] sec Suspicion thread period
154  */
155 
156  void set_suspicions_processing_period(unsigned int sec);
157 
158  /**
159  Retrieves non-member expel timeout in 100s of nanoseconds.
160  @return Non-member expel timeout
161  */
162 
163  uint64_t get_non_member_expel_timeout();
164 
165  /**
166  Sets the time interval to wait before removing non-member nodes marked to
167  be expelled from the cluster.
168  @param[in] sec Suspicions timeout in seconds
169  */
170 
171  void set_non_member_expel_timeout_seconds(unsigned long sec);
172 
173  /**
174  Retrieves member expel timeout in 100s of nanoseconds.
175  @return Member expel timeout
176  */
177 
178  uint64_t get_member_expel_timeout();
179 
180  /**
181  Sets the time interval to wait before removing member nodes marked to be
182  expelled from the cluster.
183  @param[in] sec Expel suspicions timeout in seconds
184  */
185 
186  void set_member_expel_timeout_seconds(unsigned long sec);
187 
188  /**
189  Sets the hash for the current group identifier.
190  @param[in] gid_h Group ID hash
191  */
192 
193  void set_groupid_hash(unsigned int gid_h);
194 
195  /**
196  Sets the information for this node
197  @param[in] node_info Information on this node
198  */
199 
200  void set_my_info(Gcs_xcom_node_information *node_info);
201 
202  /**
203  Auxiliary method to wake the suspicions processing thread and set if it
204  should terminate or not.
205  @param[in] terminate Signals if thread should terminate
206  */
207 
209 
210  /**
211  Auxiliary method to inform the suspicions manager that this node is in
212  a group with the majority of the configured nodes.
213  @param[in] majority Signals if the group has the majority of the nodes
214  alive
215  */
216 
217  void inform_on_majority(bool majority);
218 
219  /**
220  Auxiliary method to retrieve if the suspicions manager has the majority
221  enabled.
222  @return majority
223  */
224  bool has_majority();
225 
226  /*
227  Updates the synode_no of the last message removed from the XCom cache.
228 
229  @param[in] last_removed The synode_no of the last message removed from the
230  cache.
231  */
232  void update_last_removed(synode_no last_removed);
233 
234  private:
235  /**
236  Invoked by Gcs_suspicions_manager::process_view, it verifies if any
237  of the nodes in the received list was a suspect and removes it from
238  m_suspicions.
239  @param[in] nodes List of nodes to remove from m_suspicions
240  */
241 
242  void remove_suspicions(std::vector<Gcs_member_identifier *> nodes);
243 
244  /**
245  Invoked by Gcs_suspicions_manager::process_view, it adds suspicions
246  for the nodes received as argument if they aren't already suspects.
247 
248  @param[in] xcom_nodes List of all nodes (i.e. alive or dead) with low level
249  information such as timestamp, unique identifier, etc
250  @param[in] non_member_suspect_nodes List of joining nodes to add to
251  m_suspicions
252  @param[in] member_suspect_nodes List of previously active nodes to add to
253  m_suspicions
254  @param[in] max_synode XCom max synode
255  @return Indicates if new suspicions were added
256  */
257 
258  bool add_suspicions(
259  Gcs_xcom_nodes *xcom_nodes,
260  std::vector<Gcs_member_identifier *> non_member_suspect_nodes,
261  std::vector<Gcs_member_identifier *> member_suspect_nodes,
262  synode_no max_synode);
263 
264  /*
265  XCom proxy pointer
266  */
268 
269  /*
270  XCom control interface pointer
271  */
273 
274  /*
275  Suspicions processing thread period in seconds
276  */
278 
279  /*
280  Non-member expel timeout stored in 100s of nanoseconds
281  */
283 
284  /*
285  Member expel timeout stored in 100s of nanoseconds
286  */
288 
289  /*
290  Group ID hash
291  */
292  unsigned int m_gid_hash;
293 
294  /*
295  List of suspicions
296  */
298 
299  /*
300  Mutex to control access to m_suspicions
301  */
303 
304  /*
305  Condition used to wake up suspicions thread
306  */
308 
309  /*
310  Mutex to control access to suspicions parameters
311  */
313 
314  /*
315  Signals if node should remove suspect nodes from group.
316  */
318 
319  /*
320  Pointer to this node's information
321  */
323 
324  /*
325  Signals if group has a majority of alive nodes.
326  */
328 
329  /*
330  The synode_no of the last message removed from the XCom cache.
331  The suspicions manager will use this to verify if a suspected node has
332  gone too far behind the group to be recoverable; when that happens, it
333  will print a warning message.
334  */
336 
337  /*
338  The set of expels we have issued but that have not yet taken effect.
339  */
341 
342  /*
343  The XCom configuration/membership ID of the last view we processed.
344  */
345  synode_no m_config_id;
346 
347  /*
348  Disabling the copy constructor and assignment operator.
349  */
352 };
353 
354 /**
355  @class Gcs_xcom_control_interface
356 
357  This class implements the generic Gcs_control_interface. It relates with:
358  - Gcs_xcom_interface, since the view_changed registered callback will
359  delegate its calls to an instance of this class.
360  - Gcs_xcom_control_proxy in order to isolate xcom calls from their
361  actual implementation, to allow unit testing
362  - Gcs_xcom_view_change_control_interface that implements a structure
363  to allow View Safety. This ensures that, while the view installation
364  procedure is not finished, all applications are not allowed to execute
365  operations based upon a possible inconsistent state.
366 */
368  public:
369  static constexpr int CONNECTION_ATTEMPTS = 10;
370 
371  /**
372  Gcs_xcom_control_interface constructor.
373 
374  @param[in] xcom_node_address Information about the node's address
375  @param[in] xcom_peers Information about the nodes that it
376  should get in touch to enter a group
377 
378  @param[in] group_identifier Group identifier object
379  @param[in] xcom_proxy Proxy implementation reference
380  @param[in] xcom_group_management Group management reference
381  @param[in] gcs_engine MySQL GCS engine
382  @param[in] state_exchange Reference to the State Exchange algorithm
383  implementation
384  @param[in] view_control View change control interface reference
385  @param[in] boot Whether the node will be used to bootstrap the group
386  @param[in] socket_util Reference to a socket utility
387  */
388 
389  explicit Gcs_xcom_control(
390  Gcs_xcom_node_address *xcom_node_address,
391  std::vector<Gcs_xcom_node_address *> &xcom_peers,
392  Gcs_group_identifier group_identifier, Gcs_xcom_proxy *xcom_proxy,
393  Gcs_xcom_group_management *xcom_group_management,
395  Gcs_xcom_state_exchange_interface *state_exchange,
396  Gcs_xcom_view_change_control_interface *view_control, bool boot,
397  My_xp_socket_util *socket_util);
398 
399  ~Gcs_xcom_control() override;
400 
401  // Gcs_control_interface implementation
402  enum_gcs_error join() override;
403 
404  enum_gcs_error do_join(const bool retry = true);
405 
406  /*
407  Responsible for doing the heavy lifting related to the join
408  operation.
409  */
410  enum_gcs_error retry_do_join();
411 
412  enum_gcs_error leave() override;
413 
414  /*
415  Responsible for doing the heavy lifting related to the leave operation.
416  Triggers and oversees the termination of XCom, then calls 'do_leave_gcs'.
417  */
418  enum_gcs_error do_leave();
419 
420  /**
421  Sends a leave view message to informat that XCOM has already exited or
422  is about to do so.
423  */
424  void do_leave_view();
425 
426  /**
427  Request other members to remove node from the group.
428  */
429  void do_remove_node_from_group();
430 
431  bool belongs_to_group() override;
432 
433  Gcs_view *get_current_view() override;
434 
435  const Gcs_member_identifier get_local_member_identifier() const override;
436 
437  int add_event_listener(
438  const Gcs_control_event_listener &event_listener) override;
439 
440  void remove_event_listener(int event_listener_handle) override;
441 
442  /**
443  The purpose of this method is to be called when in Gcs_xcom_interface
444  callback method of View Changing is invoked.
445 
446  This allows, in terms of software architecture, to concentrate all the
447  view change logic and processing in a single place. The view_change
448  callback that is registered in Gcs_xcom_interface should be a simple
449  pass-through.
450 
451  @param[in] config_id The configuration ID that this view pertains to
452  @param[in] message_id the message that conveys the View Change
453  @param[in] xcom_nodes Set of nodes that participated in the consensus
454  to deliver the message
455  @param[in] same_view Whether this global view was already delivered.
456  @param[in] max_synode XCom max synode
457  */
458 
459  bool xcom_receive_global_view(synode_no const config_id, synode_no message_id,
460  Gcs_xcom_nodes *xcom_nodes, bool same_view,
461  synode_no max_synode);
462 
463  /*
464  This method is called in order to give a hint on what the node thinks
465  about other nodes.
466 
467  The view is ignored if 1) it has no nodes, 2) the local node does not
468  have a view installed or 3) the local node is not present in its current
469  view (i.e., it has been expelled).
470 
471  @param[in] config_id The configuration ID that this view pertains to
472  @param[in] xcom_nodes Set of nodes that participated in the consensus
473  to deliver the message
474  @param[in] max_synode XCom max synode
475 
476  @return True if the view was processed;
477  False otherwise.
478  */
479  bool xcom_receive_local_view(synode_no const config_id,
480  Gcs_xcom_nodes *xcom_nodes,
481  synode_no max_synode);
482 
483  /*
484  This method is called in order to inform that the node has left the
485  group or is about to do so.
486  */
487  bool xcom_receive_leave();
488 
489  /**
490  Process a message from the control interface and if necessary delegate it
491  to the state exchange.
492 
493  @param[in] msg message
494  @param[in] maximum_supported_protocol_version maximum supported protocol
495  version
496  @param[in] used_protocol_version protocol version in use by control message,
497  i.e. state exchange message
498  */
499 
500  void process_control_message(
501  Gcs_message *msg, Gcs_protocol_version maximum_supported_protocol_version,
502  Gcs_protocol_version used_protocol_version);
503 
504  std::map<int, const Gcs_control_event_listener &> *get_event_listeners();
505 
506  /**
507  Return the address associated with the current node.
508  */
509  Gcs_xcom_node_address *get_node_address();
510 
511  /**
512  @returns the information about the local membership of this node.
513  */
514  Gcs_xcom_node_information const &get_node_information() const;
515 
516  /**
517  Return a pointer to the proxy object used to access XCOM.
518  */
519  Gcs_xcom_proxy *get_xcom_proxy();
520 
521  Gcs_suspicions_manager *get_suspicions_manager();
522 
523  // For testing purposes
524  void set_boot_node(bool boot);
525 
526  /**
527  Set the address associated with the current node.
528  */
529  void set_node_address(Gcs_xcom_node_address *node_address);
530 
531  /**
532  Inserts in m_initial_peers copies of the Gcs_xcom_node_address
533  objects whose addresses are in the xcom_peers vector.
534 
535  @param[in] xcom_peers vector with peers' information
536  */
537 
538  void set_peer_nodes(std::vector<Gcs_xcom_node_address *> &xcom_peers);
539 
540  /**
541  Deletes all the Gcs_xcom_node_address objects pointed by the
542  elements of the m_initial_peers vector, clearing it at the end.
543  */
544 
545  void clear_peer_nodes();
546 
547  /**
548  Return a pointer to a socket utility.
549 
550  @return a pointer to a socket utility
551  */
552 
553  My_xp_socket_util *get_socket_util();
554 
555  /**
556  This member function can be used to wait until xcom thread exits.
557  */
558  void wait_for_xcom_thread();
559 
560  /**
561  Whether XCOM's Thread is running or not.
562  */
563  bool is_xcom_running();
564 
565  /*
566  Configure how many times the node will try to join a group.
567 
568  @param[in] join_attempts number of attempts to join
569  @param[in] join_sleep_time time between attempts to join
570  */
571  void set_join_behavior(unsigned int join_attempts,
572  unsigned int join_sleep_time);
573 
574  /**
575  Sets a new value for the maximum size of the XCom cache.
576 
577  @param[in] size the new maximum size of the XCom cache
578  @retval - GCS_OK if request was successfully scheduled in XCom,
579  GCS_NOK otherwise.
580  */
581  enum_gcs_error set_xcom_cache_size(uint64_t size) override;
582 
583  /**
584  Notify that the current member has left the group and whether it left
585  gracefully or not.
586 
587  @param[in] error_code that identifies whether there was any error
588  when the view was received.
589  */
590  void install_leave_view(Gcs_view::Gcs_view_error_code error_code);
591 
592  private:
593  void init_me();
594 
595  /*
596  Utility methods to build lists from the data that arrives with a view.
597  */
598  void build_total_members(
599  Gcs_xcom_nodes *xcom_nodes,
600  std::vector<Gcs_member_identifier *> &alive_members,
601  std::vector<Gcs_member_identifier *> &failed_members);
602 
603  void build_left_members(
604  std::vector<Gcs_member_identifier *> &left_members,
605  std::vector<Gcs_member_identifier *> &alive_members,
606  std::vector<Gcs_member_identifier *> &failed_members,
607  const std::vector<Gcs_member_identifier> *current_members);
608 
609  void build_joined_members(
610  std::vector<Gcs_member_identifier *> &joined_members,
611  std::vector<Gcs_member_identifier *> &alive_members,
612  const std::vector<Gcs_member_identifier> *current_members);
613 
614  void build_member_suspect_nodes(
615  std::vector<Gcs_member_identifier *> &member_suspect_nodes,
616  std::vector<Gcs_member_identifier *> &failed_members,
617  const std::vector<Gcs_member_identifier> *current_members);
618 
619  void build_non_member_suspect_nodes(
620  std::vector<Gcs_member_identifier *> &non_member_suspect_nodes,
621  std::vector<Gcs_member_identifier *> &failed_members,
622  const std::vector<Gcs_member_identifier> *current_members);
623 
624  /**
625  Decides if this node shall be the one to kill failed nodes. The algorithm
626  is: i am the highest node id alive.
627 
628  @param alive_members Set of alive members.
629 
630  @return true if i am the node responsible to call remove_node to expel
631  another member
632  */
633  bool is_killer_node(
634  const std::vector<Gcs_member_identifier *> &alive_members) const;
635 
636  /**
637  Copies from a set to a vector of Gcs_member_identifier.
638 
639  @param[in] origin original set
640  @param[in] to_fill destination vector
641  */
642 
643  void build_member_list(std::set<Gcs_member_identifier *> *origin,
644  std::vector<Gcs_member_identifier> *to_fill);
645 
646  /**
647  Makes all the necessary arrangements to install a new view in the binding
648  and in all registered client applications.
649 
650  @param[in] new_view_id new view identifier
651  @param[in] group_id group id
652  @param[in] states collection of states to set in the new view
653  @param[in] total all the members
654  @param[in] left members that left the last view
655  @param[in] join members that joined from the last view
656  @param[in] error_code Error code to set in the new view
657  */
658  void install_view(
659  Gcs_xcom_view_identifier *new_view_id,
660  const Gcs_group_identifier &group_id,
661  std::map<Gcs_member_identifier, Xcom_member_state *> *states,
662  std::set<Gcs_member_identifier *> *total,
663  std::set<Gcs_member_identifier *> *left,
664  std::set<Gcs_member_identifier *> *join,
666 
667  /**
668  Check whether the current member is in the received vector of members.
669 
670  @param[in] members list of members
671  */
672  bool is_this_node_in(std::vector<Gcs_member_identifier *> *members);
673 
674  /**
675  Cycle through peers_list and try to open a connection to the peer, if it
676  isn't the node itself.
677 
678  @param[in] peers_list list of the peers
679 
680  @return connection descriptor to a peer
681  */
682  connection_descriptor *get_connection_to_node(
683  std::vector<Gcs_xcom_node_address *> *peers_list);
684 
685  /**
686  Attempts to send an add_node request to some initial peer from @c
687  m_initial_peers.
688  Performs up to @c s_connection_attempts attempts.
689 
690  @param my_addresses The addresses of this node, used to filter our own
691  address from the initial peers.
692  @returns true if the add_node request was successfully sent, false
693  otherwise.
694  */
695  bool send_add_node_request(std::map<std::string, int> const &my_addresses);
696 
697  /**
698  Attempts to send an add_node request to some initial peer from @c
699  m_initial_peers.
700 
701  @param my_addresses The addresses of this node, used to filter our own
702  address from the initial peers.
703  @returns true if the add_node request was successfully sent, false
704  otherwise.
705  */
706  bool try_send_add_node_request_to_seeds(
707  std::map<std::string, int> const &my_addresses);
708 
709  /**
710  Connects to the given peer's XCom.
711 
712  @param peer Peer to connect to.
713  @param my_addresses The addresses of this node, used to filter our own
714  address from the initial peers.
715  @retval {true, connection_descriptor*} If we connected successfully.
716  @retval {false, _} If we could not connect.
717  */
718  std::pair<bool, connection_descriptor *> connect_to_peer(
719  Gcs_xcom_node_address &peer,
720  std::map<std::string, int> const &my_addresses);
721 
722  /**
723  * Expel the given members from XCom.
724  *
725  * @param incompatible_members the members to expel
726  */
727  void expel_incompatible_members(
728  std::vector<Gcs_xcom_node_information> const &incompatible_members);
729 
730  // The group that this interface pertains
732  unsigned int m_gid_hash;
733 
734  // Reference to the proxy between xcom and this implementation
736 
737  // Reference to the group management object.
739 
740  // Map holding all the registered control event listeners
741  std::map<int, const Gcs_control_event_listener &> event_listeners;
742 
743  // Information about the local membership of this node
745 
746  // Reference to the local physical node information
748 
749  // A reference of the State Exchange algorithm implementation
751 
752  // XCom main loop
754 
755  // Socket utility.
757 
758  /*
759  Number of attempts to join a group before giving up and reporting
760  an error.
761  */
762  unsigned int m_join_attempts;
763 
764  /*
765  Number of time in seconds to wait between attempts to join a group.
766  */
767  unsigned int m_join_sleep_time;
768 
769  // Suspect nodes holding object
771 
772  // Suspicions processing task
774 
775  // Proxy to GCS Sock Probe
777 
778  protected:
779  /*
780  Whether the XCOM was left running or not meaning that the join
781  operation was successfuly executed. Note, however, that this
782  does not mean that any view was delivered yet.
783 
784  This flag is only updated by the MySQL GCS engine when the join
785  and leave are processed.
786  */
788 
789  /*
790  Whether it was requested to make the node leave the group or not.
791  */
793 
794  /*
795  Whether a view saying that the node has voluntarily left the group
796  was delivered or not.
797  */
799 
800  /* Whether this site boots the group or not. */
801  bool m_boot;
802 
803  // Reference to the remote node to whom I shall connect
804  std::vector<Gcs_xcom_node_address *> m_initial_peers;
805 
806  // Reference to the mechanism that ensures view safety
808 
809  // Reference to the MySQL GCS Engine
811 
812  private:
813  /*
814  Disabling the copy constructor and assignment operator.
815  */
818 };
819 #endif /* GCS_XCOM_CONTROL_INTERFACE_INCLUDED */
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:2243
static task_env * retry
Definition: xcom_base.cc:416
My_xp_cond_impl m_suspicions_cond
Definition: gcs_xcom_control_interface.h:307
uint64_t m_member_expel_timeout
Definition: gcs_xcom_control_interface.h:287
void set_my_info(Gcs_xcom_node_information *node_info)
Sets the information for this node.
Definition: gcs_xcom_control_interface.cc:2260
My_xp_thread_impl m_xcom_thread
Definition: gcs_xcom_control_interface.h:753
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:2209
bool has_majority()
Auxiliary method to retrieve if the suspicions manager has the majority enabled.
Definition: gcs_xcom_control_interface.cc:2270
synode_no m_config_id
Definition: gcs_xcom_control_interface.h:345
Gcs_xcom_view_change_control_interface * m_view_control
Definition: gcs_xcom_control_interface.h:807
std::map< int, const Gcs_control_event_listener & > event_listeners
Definition: gcs_xcom_control_interface.h:741
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:1994
It represents a node within a group and is identified by the member identifier, unique identifier and...
Definition: gcs_xcom_group_member_information.h:192
bool m_leave_view_requested
Definition: gcs_xcom_control_interface.h:792
unsigned int m_suspicions_processing_period
Definition: gcs_xcom_control_interface.h:277
Gcs_xcom_group_management * m_xcom_group_management
Definition: gcs_xcom_control_interface.h:738
bool m_boot
Definition: gcs_xcom_control_interface.h:801
Definition: my_xp_cond.h:133
bool m_xcom_running
Definition: gcs_xcom_control_interface.h:787
synode_no m_cache_last_removed
Definition: gcs_xcom_control_interface.h:335
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:1921
The set of expels we have issued but that have not yet taken effect.
Definition: gcs_xcom_expels_in_progress.h:55
unsigned int get_suspicions_processing_period()
Retrieves suspicion thread period in seconds.
Definition: gcs_xcom_control_interface.cc:2183
synode_no max_synode
Definition: xcom_base.cc:386
Definition: gcs_xcom_control_interface.h:367
Gcs_suspicions_manager & operator=(Gcs_suspicions_manager const &)
unsigned int m_gid_hash
Definition: gcs_xcom_control_interface.h:292
enum_gcs_error
This enumeration describes errors which can occur during group communication operations.
Definition: gcs_types.h:40
std::string join(Container cont, const std::string &delim)
join elements of an container into a string seperated by a delimiter.
Definition: string.h:144
static xcom_global_view_receiver xcom_receive_global_view
Definition: xcom_interface.cc:56
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:2264
Class that represents the data that is exchanged within a group.
Definition: gcs_message.h:338
Gcs_protocol_version
The GCS protocol versions.
Definition: gcs_types.h:127
Gcs_xcom_expels_in_progress m_expels_in_progress
Definition: gcs_xcom_control_interface.h:340
Gcs_xcom_node_information * m_local_node_info
Definition: gcs_xcom_control_interface.h:744
My_xp_mutex_impl m_suspicions_parameters_mutex
Definition: gcs_xcom_control_interface.h:312
Gcs_xcom_node_address * m_local_node_address
Definition: gcs_xcom_control_interface.h:747
This class stores all node suspicions, as well as the timeout and period parameters used by the threa...
Definition: gcs_xcom_control_interface.h:67
Gcs_suspicions_manager * m_suspicions_manager
Definition: gcs_xcom_control_interface.h:770
uint64_t get_non_member_expel_timeout()
Retrieves non-member expel timeout in 100s of nanoseconds.
Definition: gcs_xcom_control_interface.cc:2200
bool m_leave_view_delivered
Definition: gcs_xcom_control_interface.h:798
bool m_has_majority
Definition: gcs_xcom_control_interface.h:327
This interface is implemented by those who wish to receive Control Interface notifications.
Definition: gcs_control_event_listener.h:51
uint64_t get_member_expel_timeout()
Retrieves member expel timeout in 100s of nanoseconds.
Definition: gcs_xcom_control_interface.cc:2218
Gcs_xcom_nodes m_suspicions
Definition: gcs_xcom_control_interface.h:297
unsigned int m_gid_hash
Definition: gcs_xcom_control_interface.h:732
Gcs_xcom_state_exchange_interface * m_state_exchange
Definition: gcs_xcom_control_interface.h:750
Definition: gcs_xcom_notification.h:93
Interface for socket utility methods.
Definition: my_xp_util.h:153
Type total(const Shards< COUNT > &shards) noexcept
Get the total value of all shards.
Definition: ut0counter.h:332
Gcs_xcom_engine * m_gcs_engine
Definition: gcs_xcom_control_interface.h:810
Definition: my_xp_thread.h:136
Gcs_group_identifier * m_gid
Definition: gcs_xcom_control_interface.h:731
static std::mutex lock
Definition: net_ns.cc:55
const Gcs_xcom_nodes & get_suspicions() const
Retrieves current list of suspicions.
Definition: gcs_xcom_control_interface.cc:2239
task_env * boot
Definition: xcom_base.cc:387
Definition: gcs_xcom_proxy.h:49
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:2083
~Gcs_suspicions_manager()
Destructor for Gcs_suspicions_manager.
Definition: gcs_xcom_control_interface.cc:1880
Definition: gcs_view.h:59
Gcs_xcom_proxy * m_proxy
Definition: gcs_xcom_control_interface.h:267
Definition: node_connection.h:44
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:39
This represents the membership view that a member has from a group.
Definition: gcs_view.h:54
bool m_is_killer_node
Definition: gcs_xcom_control_interface.h:317
void clear_suspicions()
Clear all suspicions.
Definition: gcs_xcom_control_interface.cc:1904
static int majority(bit_set const *nodeset, site_def const *s, int all, int delay, int force)
Definition: xcom_base.cc:709
Interface to decouple XCom sock_probe implementation to allow unit testing.
Definition: gcs_xcom_networking.h:41
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:2191
char msg[1024]
Definition: test_sql_9_sessions.cc:281
Gcs_xcom_node_information * m_my_info
Definition: gcs_xcom_control_interface.h:322
void set_groupid_hash(unsigned int gid_h)
Sets the hash for the current group identifier.
Definition: gcs_xcom_control_interface.cc:2235
Stores connection information associated with a node.
Definition: gcs_xcom_group_member_information.h:50
This class contains information on the configuration, i.e set of nodes or simply site definition...
Definition: gcs_xcom_group_member_information.h:390
unsigned int m_join_sleep_time
Definition: gcs_xcom_control_interface.h:767
My_xp_thread_impl m_suspicions_processing_thread
Definition: gcs_xcom_control_interface.h:773
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:1886
Gcs_xcom_proxy * m_xcom_proxy
Definition: gcs_xcom_control_interface.h:735
Gcs_view_error_code
Define error codes associated to the view.
Definition: gcs_view.h:59
Gcs_xcom_control * m_control_if
Definition: gcs_xcom_control_interface.h:272
Rudimentary task system in portable C, based on Tom Duff&#39;s switch-based coroutine trick and a stack...
My_xp_mutex_impl m_suspicions_mutex
Definition: gcs_xcom_control_interface.h:302
unsigned int m_join_attempts
Definition: gcs_xcom_control_interface.h:762
static Gcs_xcom_engine * gcs_engine
Definition: gcs_xcom_interface.cc:110
std::vector< Gcs_xcom_node_address * > m_initial_peers
Definition: gcs_xcom_control_interface.h:804
void process_suspicions()
Invoked periodically by the suspicions processing thread, it picks a timestamp and verifies which sus...
Definition: gcs_xcom_control_interface.cc:2054
Definition: gcs_xcom_state_exchange.h:715
Definition: my_xp_mutex.h:120
Definition: gcs_xcom_state_exchange.h:369
Definition: gcs_xcom_view_identifier.h:32
static xcom_local_view_receiver xcom_receive_local_view
Definition: xcom_interface.cc:55
This represents the unique identification of a group.
Definition: gcs_group_identifier.h:34
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:2226
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:1858
This interface represents all the control functionalities that a binding implementation must provide...
Definition: gcs_control_interface.h:110
My_xp_socket_util * m_socket_util
Definition: gcs_xcom_control_interface.h:756
void update_last_removed(synode_no last_removed)
Definition: gcs_xcom_control_interface.cc:2278
bool terminate(THD *thd)
Drop all DD tables in case there is an error while upgrading server.
Definition: upgrade.cc:682
static struct my_cs_file_section_st sec[]
Definition: ctype.cc:159
Definition: gcs_xcom_group_management.h:35
Gcs_sock_probe_interface * m_sock_probe_interface
Definition: gcs_xcom_control_interface.h:776
uint64_t m_non_member_expel_timeout
Definition: gcs_xcom_control_interface.h:282