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