MySQL 9.1.0
Source Code Documentation
recovery_metadata_observer.h
Go to the documentation of this file.
1/* Copyright (c) 2023, 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 RECOVERY_METADATA_OBSERVER_H
25#define RECOVERY_METADATA_OBSERVER_H
26
29
30/**
31 @class Recovery_metadata_observer
32 This class is used by:
33 1. joiner: to keep track of all leaving recovery metadata donors,
34 so that joiner can error out if no donor is available.
35 2. recovery metadata donors:
36 to keep track of all leaving recovery metadata donors,
37 so that other donor can send metadata if any exisiting
38 donor has left before successfully sending data.
39*/
41 public:
42 /**
43 Constructor
44 Register observer to get notification on view change.
45 */
47
48 /**
49 Destructor.
50 Unregister observers
51 */
52 virtual ~Recovery_metadata_observer() override;
53
54 private:
55 /**
56 Executed after view install and before primary election
57
58 @param joining members joining the group
59 @param leaving members leaving the group
60 @param group members in the group
61 @param is_leaving is the member leaving
62 @param[out] skip_election skip primary election on view
63 @param[out] election_mode election mode
64 @param[out] suggested_primary what should be the next primary to elect
65 */
66 int after_view_change(const std::vector<Gcs_member_identifier> &joining,
67 const std::vector<Gcs_member_identifier> &leaving,
68 const std::vector<Gcs_member_identifier> &group,
69 bool is_leaving, bool *skip_election,
70 enum_primary_election_mode *election_mode,
71 std::string &suggested_primary) override;
72
73 /**
74 Executed after primary election
75
76 @param primary_uuid the elected primary
77 @param primary_change_status if the primary changed after the election
78 @param election_mode what was the election mode
79 @param error if there was and error on the process
80 */
82 std::string primary_uuid,
84 enum_primary_election_mode election_mode, int error) override;
85
86 /**
87 Executed before the message is processed
88
89 @param message The GCS message
90 @param message_origin The member that sent this message (address)
91 @param[out] skip_message skip message handling if true
92 */
94 const std::string &message_origin,
95 bool *skip_message) override;
96};
97
98#endif /* RECOVERY_METADATA_OBSERVER_H */
Class that others can extend to receive notifications about views and primary elections.
Definition: group_event_observer.h:40
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:64
This class is used by:
Definition: recovery_metadata_observer.h:40
Recovery_metadata_observer()
Constructor Register observer to get notification on view change.
Definition: recovery_metadata_observer.cc:28
int after_view_change(const std::vector< Gcs_member_identifier > &joining, const std::vector< Gcs_member_identifier > &leaving, const std::vector< Gcs_member_identifier > &group, bool is_leaving, bool *skip_election, enum_primary_election_mode *election_mode, std::string &suggested_primary) override
Executed after view install and before primary election.
Definition: recovery_metadata_observer.cc:36
int after_primary_election(std::string primary_uuid, enum_primary_election_primary_change_status primary_change_status, enum_primary_election_mode election_mode, int error) override
Executed after primary election.
Definition: recovery_metadata_observer.cc:99
virtual ~Recovery_metadata_observer() override
Destructor.
Definition: recovery_metadata_observer.cc:32
int before_message_handling(const Plugin_gcs_message &message, const std::string &message_origin, bool *skip_message) override
Executed before the message is processed.
Definition: recovery_metadata_observer.cc:106
enum_primary_election_mode
Enum for election types.
Definition: primary_election_include.h:33
enum_primary_election_primary_change_status
Enum for primary change status.
Definition: primary_election_include.h:50