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