MySQL  8.0.22
Source Code Documentation
gcs_xcom_group_management.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 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_GROUP_MANAGEMENT_INCLUDED
24 #define GCS_XCOM_GROUP_MANAGEMENT_INCLUDED
25 
26 #include "plugin/group_replication/libmysqlgcs/include/mysql/gcs/gcs_group_management_interface.h" // Base class: Gcs_group_management_interface
31 
32 #include <string>
33 #include <vector>
34 
36  public:
38  Gcs_xcom_proxy *xcom_proxy, const Gcs_group_identifier &group_identifier);
39  ~Gcs_xcom_group_management() override;
40 
42  const Gcs_interface_parameters &reconfigured_group) override;
43 
44  enum_gcs_error get_write_concurrency(uint32_t &event_horizon) const override;
45 
46  enum_gcs_error set_write_concurrency(uint32_t event_horizon) override;
47 
48  uint32_t get_minimum_write_concurrency() const override;
49 
50  uint32_t get_maximum_write_concurrency() const override;
51 
52  /**
53  Save information on the latest nodes seen by this node so that it
54  can safely reconfigure the group if it loses the majority. This
55  information is required to extract the set of possible alive nodes
56  and their UUIDs. If the UUIDs in the reconfiguration request do not
57  match those stored in XCOM, it will not allow the reconfiguration
58  to proceed.
59 
60  Note also that the set of nodes is updated by the MySQL GCS thread
61  whenever a new configuration is delivered and that a user thread is
62  responsible for calling the reconfiguration process. If a user is
63  trying to reconfigure the system, this usually and unfortunately
64  means that it has lost the majority and nothing will be updated by
65  the MySQL GCS thread. However, just for the sake of completeness,
66  we will use a mutex here to control access to this data structure.
67 
68  Finally, it is worth noting that we cannot use get_site_def() here
69  because information on nodes could be concurrently updated by the
70  XCOM thread and we cannot add a mutex to it.
71  */
72  void set_xcom_nodes(const Gcs_xcom_nodes &xcom_nodes);
73 
74  /*
75  Get a copy of the nodes in the current configuration that are in the
76  filter list.
77 
78  @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
79  filter list
80  @param[in] filter The list of nodes identified as a string that one is
81  interested in retrieving information on
82  */
83  void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
84  const std::vector<std::string> &filter);
85 
86  /*
87  Get a copy of the nodes in the current configuration that are in the
88  filter list.
89 
90  @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
91  filter list
92  @param[in] filter The list of nodes identified as Gcs_member_identifier(s)
93  that one is interested in retrieving information on
94  */
95  void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
96  const std::vector<Gcs_member_identifier> &filter);
97 
98  /*
99  Get a copy of the nodes in the current configuration that are in the
100  filter list.
101 
102  @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
103  filter list
104  @param[in] filter The list of nodes identified as Gcs_member_identifier(s)
105  that one is interested in retrieving information on
106  */
107  void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
108  const std::vector<Gcs_member_identifier *> &filter);
109 
110  private:
114  unsigned int m_gid_hash;
115 
116  /*
117  Mutex used to prevent concurrent access to nodes.
118  */
120 
121  /*
122  Disabling the copy constructor and assignment operator.
123  */
126 };
127 #endif // GCS_XCOM_GROUP_MANAGEMENT_INCLUDED
enum_gcs_error set_write_concurrency(uint32_t event_horizon) override
Reconfigures the group&#39;s "write concurrency" value.
Definition: gcs_xcom_group_management.cc:176
Gcs_xcom_proxy * m_xcom_proxy
Definition: gcs_xcom_group_management.h:111
This class is to be used to provide parameters to bindings in a transparent and generic way...
Definition: gcs_types.h:58
Gcs_group_identifier * m_gid
Definition: gcs_xcom_group_management.h:112
enum_gcs_error
This enumeration describes errors which can occur during group communication operations.
Definition: gcs_types.h:40
void set_xcom_nodes(const Gcs_xcom_nodes &xcom_nodes)
Save information on the latest nodes seen by this node so that it can safely reconfigure the group if...
Definition: gcs_xcom_group_management.cc:51
enum_gcs_error modify_configuration(const Gcs_interface_parameters &reconfigured_group) override
Method that allows sending of a new group configuration.
Definition: gcs_xcom_group_management.cc:92
Definition: gcs_xcom_proxy.h:49
void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes, const std::vector< std::string > &filter)
Definition: gcs_xcom_group_management.cc:80
Gcs_xcom_group_management(Gcs_xcom_proxy *xcom_proxy, const Gcs_group_identifier &group_identifier)
Definition: gcs_xcom_group_management.cc:32
Gcs_xcom_group_management & operator=(Gcs_xcom_group_management const &)
This class contains information on the configuration, i.e set of nodes or simply site definition...
Definition: gcs_xcom_group_member_information.h:390
enum_gcs_error get_write_concurrency(uint32_t &event_horizon) const override
Retrieves the group&#39;s "write concurrency" value.
Definition: gcs_xcom_group_management.cc:167
uint32_t get_minimum_write_concurrency() const override
Retrieves the minimum supported "write concurrency" value.
Definition: gcs_xcom_group_management.cc:159
~Gcs_xcom_group_management() override
Definition: gcs_xcom_group_management.cc:46
Definition: my_xp_mutex.h:120
unsigned int m_gid_hash
Definition: gcs_xcom_group_management.h:114
This represents the unique identification of a group.
Definition: gcs_group_identifier.h:34
Definition: gcs_group_management_interface.h:28
My_xp_mutex_impl m_nodes_mutex
Definition: gcs_xcom_group_management.h:119
uint32_t get_maximum_write_concurrency() const override
Retrieves the maximum supported "write concurrency" value.
Definition: gcs_xcom_group_management.cc:163
Gcs_xcom_nodes m_xcom_nodes
Definition: gcs_xcom_group_management.h:113
Definition: gcs_xcom_group_management.h:35