MySQL 9.1.0
Source Code Documentation
compatibility_module.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 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 COMPATIBILITY_MODULE_INCLUDED
25#define COMPATIBILITY_MODULE_INCLUDED
26
27#include <map>
28#include <set>
29
31
32/* Possible outcomes when checking inter version compatibility */
34 INCOMPATIBLE = 0, // Versions not compatible
35 INCOMPATIBLE_LOWER_VERSION, // Versions not compatible, member has lower
36 // version
37 COMPATIBLE, // Versions compatible
38 READ_COMPATIBLE // Member can read but not write
40
42 public:
45
46 /**
47 Returns this member version
48 */
50
51 /**
52 Set the module local version
53 @param local_version the new local version to be set
54 */
56
57 /**
58 Add a incompatibility between the given members.
59 @param from The member that is not compatible with 'to'
60 @param to The member with which 'from' is not compatible with
61 */
63
64 /**
65 Add a incompatibility between a range of member versions.
66 @param from The member that is not compatible with 'to'
67 @param to_min The minimum version with which 'from' is not compatible with
68 @param to_max The maximum version with which 'from' is not compatible with
69 */
71 Member_version &to_max);
72
73 /**
74 Checks if the given version is incompatible with another version.
75 @param from The member that may be not compatible with 'to'
76 @param to The member with which 'from' may be not compatible with
77 @param do_version_check If version compatibility check is needed
78 @param all_members_versions The version of all members on the group
79 @return the compatibility status
80 @retval INCOMPATIBLE The versions are not compatible with each other
81 @retval COMPATIBLE The versions are compatible with each other
82 @retval READ_COMPATIBLE The version 'from' can only read from 'to'
83 */
85 Member_version &from, Member_version &to, bool do_version_check,
86 const std::set<Member_version> &all_members_versions);
87
88 /**
89 Checks if the given version is incompatible with another version.
90 @param from The member that may be not compatible with 'to'
91 @param to The member with which 'from' may be not compatible with
92 @return the compatibility status
93 @retval INCOMPATIBLE The versions are not compatible with each other
94 @retval COMPATIBLE The versions are compatible with each other
95 @retval READ_COMPATIBLE The version 'from' can only read from 'to'
96 */
99 /**
100 Checks if the given version is incompatible with another version.
101 @param from The member that may be not compatible with 'to'
102 @param to_min The minimum version with which 'from' is not compatible with
103 @param to_max The maximum version with which 'from' is not compatible with
104
105 @return the compatibility status
106 @retval true The version is in the range of the incompatible versions
107 @retval false The version is not in the range of the incompatible
108 versions
109 */
111 unsigned int to_min,
112 unsigned int to_max);
113 /**
114 Checks if the given version is compatible with this member local version.
115 @param to The member with which 'from' may be not compatible with
116 @param is_lowest_version If to version is lowest in the group
117 @param all_members_versions The version of all members on the group
118 @return the compatibility status
119 @retval INCOMPATIBLE The versions are not compatible with each other
120 @retval COMPATIBLE The versions are compatible with each other
121 @retval READ_COMPATIBLE The version 'from' can only read from 'to'
122 */
124 Member_version &to, bool is_lowest_version,
125 const std::set<Member_version> &all_members_versions);
126
127 /**
128 Checks if the provided versions belong to the same LTS version
129 @param all_members_versions The versions
130
131 @retval true All versions belong to the same LTS version
132 @retval false Otherwise
133 */
135 const std::set<Member_version> &all_members_versions);
136
137 virtual ~Compatibility_module();
138
139 private:
140 /*The configured local version*/
142 /*
143 The incompatibility matrix: <version V, version incompatible with Vmin to
144 Vmax>
145 */
146 std::multimap<unsigned int, std::pair<unsigned int, unsigned int>>
148
149 /**
150 Checks if the version is 8.4.X.
151 @param version A server version
152
153 @retval true The version is 8.4.X
154 @retval false Otherwise
155 */
156 static bool is_version_8_4_lts(const Member_version &version);
157};
158
159#endif /* COMPATIBILITY_MODULE_INCLUDED */
Definition: compatibility_module.h:41
virtual ~Compatibility_module()
Definition: compatibility_module.cc:180
Compatibility_type check_incompatibility(Member_version &from, Member_version &to, bool do_version_check, const std::set< Member_version > &all_members_versions)
Checks if the given version is incompatible with another version.
Definition: compatibility_module.cc:93
static Compatibility_type check_version_incompatibility(Member_version from, Member_version to)
Checks if the given version is incompatible with another version.
Definition: compatibility_module.cc:173
std::multimap< unsigned int, std::pair< unsigned int, unsigned int > > incompatibilities
Definition: compatibility_module.h:147
Member_version & get_local_version()
Returns this member version.
Definition: compatibility_module.cc:36
static bool do_all_versions_belong_to_the_same_lts(const std::set< Member_version > &all_members_versions)
Checks if the provided versions belong to the same LTS version.
Definition: compatibility_module.cc:137
void set_local_version(Member_version &local_version)
Set the module local version.
Definition: compatibility_module.cc:40
Member_version * local_version
Definition: compatibility_module.h:141
Compatibility_type check_local_incompatibility(Member_version &to, bool is_lowest_version, const std::set< Member_version > &all_members_versions)
Checks if the given version is compatible with this member local version.
Definition: compatibility_module.cc:60
Compatibility_module()
Definition: compatibility_module.cc:30
static bool is_version_8_4_lts(const Member_version &version)
Checks if the version is 8.4.X.
Definition: compatibility_module.cc:158
void add_incompatibility(Member_version &from, Member_version &to)
Add a incompatibility between the given members.
Definition: compatibility_module.cc:45
bool check_version_range_incompatibility(Member_version &from, unsigned int to_min, unsigned int to_max)
Checks if the given version is incompatible with another version.
Definition: compatibility_module.cc:67
represent the MySQL version of a Member within the Group Replication group.
Definition: member_version.h:35
st_compatibility_types
Definition: compatibility_module.h:33
@ INCOMPATIBLE_LOWER_VERSION
Definition: compatibility_module.h:35
@ INCOMPATIBLE
Definition: compatibility_module.h:34
@ READ_COMPATIBLE
Definition: compatibility_module.h:38
@ COMPATIBLE
Definition: compatibility_module.h:37
enum st_compatibility_types Compatibility_type
required uint64 version
Definition: replication_group_member_actions.proto:41