MySQL 8.0.32
Source Code Documentation
gcs_xcom_group_management.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2022, 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);
41
43 const Gcs_interface_parameters &reconfigured_group) override;
44
45 enum_gcs_error get_write_concurrency(uint32_t &event_horizon) const override;
46
47 enum_gcs_error set_write_concurrency(uint32_t event_horizon) override;
48
50 Gcs_member_identifier const &leader) override;
53 std::vector<Gcs_member_identifier> &preferred_leaders,
54 std::vector<Gcs_member_identifier> &actual_leaders) override;
55
56 uint32_t get_minimum_write_concurrency() const override;
57
58 uint32_t get_maximum_write_concurrency() const override;
59
60 /**
61 Save information on the latest nodes seen by this node so that it
62 can safely reconfigure the group if it loses the majority. This
63 information is required to extract the set of possible alive nodes
64 and their UUIDs. If the UUIDs in the reconfiguration request do not
65 match those stored in XCOM, it will not allow the reconfiguration
66 to proceed.
67
68 Note also that the set of nodes is updated by the MySQL GCS thread
69 whenever a new configuration is delivered and that a user thread is
70 responsible for calling the reconfiguration process. If a user is
71 trying to reconfigure the system, this usually and unfortunately
72 means that it has lost the majority and nothing will be updated by
73 the MySQL GCS thread. However, just for the sake of completeness,
74 we will use a mutex here to control access to this data structure.
75
76 Finally, it is worth noting that we cannot use get_site_def() here
77 because information on nodes could be concurrently updated by the
78 XCOM thread and we cannot add a mutex to it.
79 */
80 void set_xcom_nodes(const Gcs_xcom_nodes &xcom_nodes);
81
82 /*
83 Get a copy of the nodes in the current configuration that are in the
84 filter list.
85
86 @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
87 filter list
88 @param[in] filter The list of nodes identified as a string that one is
89 interested in retrieving information on
90 */
91 void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
92 const std::vector<std::string> &filter);
93
94 /*
95 Get a copy of the nodes in the current configuration that are in the
96 filter list.
97
98 @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
99 filter list
100 @param[in] filter The list of nodes identified as Gcs_member_identifier(s)
101 that one is interested in retrieving information on
102 */
103 void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
104 const std::vector<Gcs_member_identifier> &filter);
105
106 /*
107 Get a copy of the nodes in the current configuration that are in the
108 filter list.
109
110 @param[out] result_xcom_nodes The set of Gcs_xcom_nodes that are in the
111 filter list
112 @param[in] filter The list of nodes identified as Gcs_member_identifier(s)
113 that one is interested in retrieving information on
114 */
115 void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes,
116 const std::vector<Gcs_member_identifier *> &filter);
117
118 private:
122 unsigned int m_gid_hash;
123
124 /*
125 Mutex used to prevent concurrent access to nodes.
126 */
128
129 /*
130 Disabling the copy constructor and assignment operator.
131 */
134};
135#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:120
Gcs_xcom_group_management & operator=(Gcs_xcom_group_management const &)
unsigned int m_gid_hash
Definition: gcs_xcom_group_management.h:122
uint32_t get_maximum_write_concurrency() const override
Retrieves the maximum supported "write concurrency" value.
Definition: gcs_xcom_group_management.cc:201
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:205
Gcs_xcom_group_management(Gcs_xcom_proxy *xcom_proxy, const Gcs_group_identifier &group_identifier)
Definition: gcs_xcom_group_management.cc:34
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:53
enum_gcs_error set_write_concurrency(uint32_t event_horizon) override
Reconfigures the group's "write concurrency" value.
Definition: gcs_xcom_group_management.cc:214
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:111
My_xp_mutex_impl m_nodes_mutex
Definition: gcs_xcom_group_management.h:127
~Gcs_xcom_group_management() override
Definition: gcs_xcom_group_management.cc:48
void get_xcom_nodes(Gcs_xcom_nodes &result_xcom_nodes, const std::vector< std::string > &filter)
Definition: gcs_xcom_group_management.cc:82
Gcs_xcom_proxy * m_xcom_proxy
Definition: gcs_xcom_group_management.h:119
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:255
enum_gcs_error set_everyone_leader() override
Reconfigures the group's "consensus leaders.".
Definition: gcs_xcom_group_management.cc:240
enum_gcs_error set_single_leader(Gcs_member_identifier const &leader) override
Reconfigures the group's "consensus leaders.".
Definition: gcs_xcom_group_management.cc:223
uint32_t get_minimum_write_concurrency() const override
Retrieves the minimum supported "write concurrency" value.
Definition: gcs_xcom_group_management.cc:197
Gcs_xcom_nodes m_xcom_nodes
Definition: gcs_xcom_group_management.h:121
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:51
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