MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
gcs_xcom_expels_in_progress.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 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_EXPELS_IN_PROGRESS_INCLUDED
25#define GCS_XCOM_EXPELS_IN_PROGRESS_INCLUDED
26
27#include <vector>
30#include "plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp.h"
31
32/**
33 @class Gcs_xcom_expels_in_progress
34
35 The set of expels we have issued but that have not yet taken effect.
36 An expel is identified as the pair (m, c), which means that we expelled the
37 member `m` based on view(s) pertaining to the XCom configuration/membership
38 `c`.
39
40 Whenever we issue the expel of some member `m`, we take note in this
41 structure; see @c remember_expels_issued.
42
43 Whenever we process a view where some member `m` that we have expelled is no
44 longer present, we remove `m` from this structure; see @c
45 forget_expels_that_have_taken_effect.
46
47 Please note that we keep track of the configuration ID `c` where we expelled
48 `m` to guard against the possibility of removing `m` from this structure due
49 to receiving a view "from the past," e.g. receiving a view from
50 configuration `b` < `c` where `m` is not a member, after having expelled `m`
51 due to views from configuration `c`.
52 It is unclear whether XCom can sometimes deliver views "from the past," so we
53 account for this situation by only removing `m` from this structure if we
54 receive a view from a configuration `d` > `c` where `m` is no longer present.
55*/
57 public:
62 default;
64 default;
65
66 /**
67 * @brief Keep track of members we expelled @c expels_issued together with
68 * the XCom configuration @c config_id_where_expels_were_issued that triggered
69 * the expel.
70 *
71 * @param config_id_where_expels_were_issued XCom configuration that triggered
72 * the expel
73 * @param expels_issued members expelled
74 */
76 synode_no const config_id_where_expels_were_issued,
77 Gcs_xcom_nodes const &expels_issued);
78
79 /**
80 * @brief Forget about any expel we issued for the members that have taken
81 * effect in the XCom configuration identified by
82 * @c config_id_where_members_under_effect.
83 *
84 * @param config_id_where_members_under_effect XCom configuration where
85 * the nodes that have left or rejoined
86 * @param members_under_effect nodes that have left or rejoined
87 */
89 synode_no const config_id_where_members_under_effect,
90 std::vector<Gcs_member_identifier *> const &members_under_effect);
91
92 /**
93 * @brief How many of the expels in progress do not pertain to suspected
94 * nodes.
95 *
96 * @param suspected_members suspected nodes that are members in the current
97 * GCS view
98 * @param suspected_nonmembers suspected nodes that are not yet members in the
99 * current GCS view
100 * @return how many of the expels in progress do not pertain to suspected
101 * nodes
102 */
104 std::vector<Gcs_member_identifier *> const &suspected_members,
105 std::vector<Gcs_member_identifier *> const &suspected_nonmembers) const;
106
107 /**
108 * @brief Whether all expels in progress are for members in @c xcom_nodes.
109 *
110 * @param xcom_nodes XCom view
111 * @retval true if all expels in progress are for members in @c xcom_nodes
112 * @retval false otherwise
113 */
114 bool all_still_in_view(Gcs_xcom_nodes const &xcom_nodes) const;
115
116 /**
117 * @brief How many expels are in progress.
118 *
119 * @return how many expels are in progress
120 */
121 std::size_t size() const;
122
123 /**
124 * @brief Whether there is an expel in progress for @c member issued during
125 * the XCom configuration identified by @c synode.
126 *
127 * @param member member to check
128 * @param synode XCom configuration to check
129 * @retval true there is an expel in progress for @c member issued during the
130 * configuration identified by @c synode
131 * @retval false otherwise
132 */
133 bool contains(Gcs_member_identifier const &member,
134 synode_no const synode) const;
135
136 /**
137 * @brief Whether there is an expel in progress for @c member issued.
138 *
139 * @param member member to check
140 * @retval true there is an expel in progress for @c member
141 * @retval false otherwise
142 */
143 bool contains(Gcs_member_identifier const &member) const;
144
145 private:
146 std::vector<std::pair<Gcs_member_identifier, synode_no>> m_expels_in_progress;
147};
148
149#endif /* GCS_XCOM_EXPELS_IN_PROGRESS_INCLUDED */
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
The set of expels we have issued but that have not yet taken effect.
Definition: gcs_xcom_expels_in_progress.h:56
Gcs_xcom_expels_in_progress(Gcs_xcom_expels_in_progress &&)=default
std::vector< std::pair< Gcs_member_identifier, synode_no > > m_expels_in_progress
Definition: gcs_xcom_expels_in_progress.h:146
std::size_t size() const
How many expels are in progress.
Definition: gcs_xcom_expels_in_progress.cc:153
Gcs_xcom_expels_in_progress & operator=(Gcs_xcom_expels_in_progress &&)=default
void forget_expels_that_have_taken_effect(synode_no const config_id_where_members_under_effect, std::vector< Gcs_member_identifier * > const &members_under_effect)
Forget about any expel we issued for the members that have taken effect in the XCom configuration ide...
Definition: gcs_xcom_expels_in_progress.cc:39
Gcs_xcom_expels_in_progress(Gcs_xcom_expels_in_progress const &)=default
Gcs_xcom_expels_in_progress & operator=(Gcs_xcom_expels_in_progress const &)=default
void remember_expels_issued(synode_no const config_id_where_expels_were_issued, Gcs_xcom_nodes const &expels_issued)
Keep track of members we expelled expels_issued together with the XCom configuration config_id_where_...
Definition: gcs_xcom_expels_in_progress.cc:30
std::size_t number_of_expels_not_about_suspects(std::vector< Gcs_member_identifier * > const &suspected_members, std::vector< Gcs_member_identifier * > const &suspected_nonmembers) const
How many of the expels in progress do not pertain to suspected nodes.
Definition: gcs_xcom_expels_in_progress.cc:110
bool all_still_in_view(Gcs_xcom_nodes const &xcom_nodes) const
Whether all expels in progress are for members in xcom_nodes.
Definition: gcs_xcom_expels_in_progress.cc:134
bool contains(Gcs_member_identifier const &member, synode_no const synode) const
Whether there is an expel in progress for member issued during the XCom configuration identified by s...
Definition: gcs_xcom_expels_in_progress.cc:157
This class contains information on the configuration, i.e set of nodes or simply site definition.
Definition: gcs_xcom_group_member_information.h:391