MySQL 9.0.0
Source Code Documentation
gcs_xcom_group_management.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef GCS_XCOM_GROUP_MANAGEMENT_INCLUDED
25#define GCS_XCOM_GROUP_MANAGEMENT_INCLUDED
26
27#include "plugin/group_replication/libmysqlgcs/include/mysql/gcs/gcs_group_management_interface.h" // Base class: Gcs_group_management_interface
33
34#include <string>
35#include <vector>
36
38 public:
40 Gcs_xcom_proxy *xcom_proxy, const Gcs_group_identifier &group_identifier,
43
45 const Gcs_interface_parameters &reconfigured_group) override;
46
47 enum_gcs_error get_write_concurrency(uint32_t &event_horizon) const override;
48
49 enum_gcs_error set_write_concurrency(uint32_t event_horizon) override;
50
52 Gcs_member_identifier const &leader) override;
55 std::vector<Gcs_member_identifier> &preferred_leaders,
56 std::vector<Gcs_member_identifier> &actual_leaders) override;
57
58 uint32_t get_minimum_write_concurrency() const override;
59
60 uint32_t get_maximum_write_concurrency() const override;
61
62 /**
63 Save information on the latest nodes seen by this node so that it
64 can safely reconfigure the group if it loses the majority. This
65 information is required to extract the set of possible alive nodes
66 and their UUIDs. If the UUIDs in the reconfiguration request do not
67 match those stored in XCOM, it will not allow the reconfiguration
68 to proceed.
69
70 Note also that the set of nodes is updated by the MySQL GCS thread
71 whenever a new configuration is delivered and that a user thread is
72 responsible for calling the reconfiguration process. If a user is
73 trying to reconfigure the system, this usually and unfortunately
74 means that it has lost the majority and nothing will be updated by
75 the MySQL GCS thread. However, just for the sake of completeness,
76 we will use a mutex here to control access to this data structure.
77
78 Finally, it is worth noting that we cannot use get_site_def() here
79 because information on nodes could be concurrently updated by the
80 XCOM thread and we cannot add a mutex to it.
81 */
82 void set_xcom_nodes(const Gcs_xcom_nodes &xcom_nodes);
83
84 /*
85 Get a copy of the nodes in the current configuration that are in the
86 filter list.
87
88 @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
89 filter list
90 @param[in] filter The list of nodes identified as a string that one is
91 interested in retrieving information on
92 */
93 void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
94 const std::vector<std::string> &filter);
95
96 /*
97 Get a copy of the nodes in the current configuration that are in the
98 filter list.
99
100 @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
101 filter list
102 @param[in] filter The list of nodes identified as Gcs_member_identifier(s)
103 that one is interested in retrieving information on
104 */
105 void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
106 const std::vector<Gcs_member_identifier> &filter);
107
108 /*
109 Get a copy of the nodes in the current configuration that are in the
110 filter list.
111
112 @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
113 filter list
114 @param[in] filter The list of nodes identified as Gcs_member_identifier(s)
115 that one is interested in retrieving information on
116 */
117 void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
118 const std::vector<Gcs_member_identifier *> &filter);
119
120 private:
124 unsigned int m_gid_hash;
125
126 /*
127 Mutex used to prevent concurrent access to nodes.
128 */
130
131 /*
132 Regulate the access to certain methods, mainly avoid sending requests
133 if this node is stopping.
134 */
136
137 /*
138 Disabling the copy constructor and assignment operator.
139 */
142};
143#endif // GCS_XCOM_GROUP_MANAGEMENT_INCLUDED
This represents the unique identification of a group.
Definition: gcs_group_identifier.h:35
Definition: gcs_group_management_interface.h:32
This class is to be used to provide parameters to bindings in a transparent and generic way.
Definition: gcs_types.h:59
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
Definition: gcs_xcom_group_management.h:37
Gcs_group_identifier * m_gid
Definition: gcs_xcom_group_management.h:122
Gcs_xcom_group_management & operator=(Gcs_xcom_group_management const &)
unsigned int m_gid_hash
Definition: gcs_xcom_group_management.h:124
Gcs_xcom_group_management(Gcs_xcom_proxy *xcom_proxy, const Gcs_group_identifier &group_identifier, Gcs_xcom_view_change_control_interface *view_control)
Definition: gcs_xcom_group_management.cc:35
uint32_t get_maximum_write_concurrency() const override
Retrieves the maximum supported "write concurrency" value.
Definition: gcs_xcom_group_management.cc:204
enum_gcs_error get_write_concurrency(uint32_t &event_horizon) const override
Retrieves the group's "write concurrency" value.
Definition: gcs_xcom_group_management.cc:208
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:56
enum_gcs_error set_write_concurrency(uint32_t event_horizon) override
Reconfigures the group's "write concurrency" value.
Definition: gcs_xcom_group_management.cc:239
Gcs_xcom_group_management(Gcs_xcom_group_management const &)
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:114
My_xp_mutex_impl m_nodes_mutex
Definition: gcs_xcom_group_management.h:129
~Gcs_xcom_group_management() override
Definition: gcs_xcom_group_management.cc:51
Gcs_xcom_view_change_control_interface * m_view_control
Definition: gcs_xcom_group_management.h:135
void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes, const std::vector< std::string > &filter)
Definition: gcs_xcom_group_management.cc:85
Gcs_xcom_proxy * m_xcom_proxy
Definition: gcs_xcom_group_management.h:121
enum_gcs_error get_leaders(std::vector< Gcs_member_identifier > &preferred_leaders, std::vector< Gcs_member_identifier > &actual_leaders) override
Inspect the group's "consensus leader" configuration.
Definition: gcs_xcom_group_management.cc:280
enum_gcs_error set_everyone_leader() override
Reconfigures the group's "consensus leaders.".
Definition: gcs_xcom_group_management.cc:265
enum_gcs_error set_single_leader(Gcs_member_identifier const &leader) override
Reconfigures the group's "consensus leaders.".
Definition: gcs_xcom_group_management.cc:248
uint32_t get_minimum_write_concurrency() const override
Retrieves the minimum supported "write concurrency" value.
Definition: gcs_xcom_group_management.cc:200
Gcs_xcom_nodes m_xcom_nodes
Definition: gcs_xcom_group_management.h:123
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:716
Definition: my_xp_mutex.h:123
enum_gcs_error
This enumeration describes errors which can occur during group communication operations.
Definition: gcs_types.h:41