MySQL 9.1.0
Source Code Documentation
primary_election_utils.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 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 PRIMARY_ELECTION_UTILS_INCLUDED
25#define PRIMARY_ELECTION_UTILS_INCLUDED
26
27#include <string>
28
30
32
34 public:
35 Election_member_info(const std::string uuid, const Member_version &version,
36 bool is_primary);
37
38 /**
39 @return The member uuid
40 */
41 std::string &get_uuid();
42
43 /**
44 @return The member version
45 */
47
48 /**
49 @note This only returns true for single primary mode
50 @return Is this member a primary?
51 */
52 bool is_primary();
53
54 /**
55 @return Did the member left the group
56 */
57 bool member_left();
58
59 /**
60 @return this member has channels?
61 */
62 bool has_channels();
63
64 /**
65 @return was this member information updated
66 */
67 bool is_information_set();
68
69 /**
70 Set the flag that tells if the member has channels
71 @param running_channels the member has channels?
72 */
73 void set_has_running_channels(bool running_channels);
74
75 /**
76 Set the flag that tells if this class was updated
77 @param set was the info updated?
78 */
79 void set_information_set(bool set);
80
81 /**
82 Did the member left the group
83 @param left did the member left the group
84 */
85 void set_member_left(bool left);
86
87 private:
88 /** The member uuid */
89 std::string member_uuid;
90 /** This member version*/
92 /** Is this member the primary*/
94 /** Does the member has running channels*/
96 /** Did the member leave?*/
98 /** Was the info for this member set*/
100};
101
102bool send_message(Plugin_gcs_message *message);
103
104/**
105 Kill transactions and enable super_read_only mode
106 @param err_msg the sql error message
107*/
108void kill_transactions_and_leave_on_election_error(std::string &err_msg);
109
110#endif /* PRIMARY_ELECTION_UTILS_INCLUDED */
Definition: primary_election_utils.h:33
bool has_running_channels
Does the member has running channels.
Definition: primary_election_utils.h:95
std::string & get_uuid()
Definition: primary_election_utils.cc:40
bool is_primary()
Definition: primary_election_utils.cc:46
void set_information_set(bool set)
Set the flag that tells if this class was updated.
Definition: primary_election_utils.cc:58
void set_member_left(bool left)
Did the member left the group.
Definition: primary_election_utils.cc:60
std::string member_uuid
The member uuid.
Definition: primary_election_utils.h:89
bool has_member_left
Did the member leave?
Definition: primary_election_utils.h:97
Member_version & get_member_version()
Definition: primary_election_utils.cc:42
bool is_information_set()
Definition: primary_election_utils.cc:52
Member_version member_version
This member version.
Definition: primary_election_utils.h:91
bool is_member_primary
Is this member the primary.
Definition: primary_election_utils.h:93
bool has_channels()
Definition: primary_election_utils.cc:50
Election_member_info(const std::string uuid, const Member_version &version, bool is_primary)
Definition: primary_election_utils.cc:30
bool info_is_set
Was the info for this member set.
Definition: primary_election_utils.h:99
bool member_left()
Definition: primary_election_utils.cc:48
void set_has_running_channels(bool running_channels)
Set the flag that tells if the member has channels.
Definition: primary_election_utils.cc:54
represent the MySQL version of a Member within the Group Replication group.
Definition: member_version.h:35
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:64
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2884
void kill_transactions_and_leave_on_election_error(std::string &err_msg)
Kill transactions and enable super_read_only mode.
Definition: primary_election_utils.cc:74
bool send_message(Plugin_gcs_message *message)
Definition: primary_election_utils.cc:64
required uint64 version
Definition: replication_group_member_actions.proto:41