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