MySQL 8.4.2
Source Code Documentation
certified_gtid.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 GR_CERTIFICATION_CERTIFIED_GTID_INCLUDED
25#define GR_CERTIFICATION_CERTIFIED_GTID_INCLUDED
26
28#include "sql/rpl_gtid.h"
29
30namespace gr {
31
32class Certified_gtid;
33
34/// @brief Class that aggregates important information about already certified
35/// gtid
36/// @details GTID consists of TSID and transaction number.
37/// Due to the fact that TSID is represented internally by the number relative
38/// to the used sidno map, there are as many GTID representations as maps used
39/// (snapshot map / global server map used in TC / group sid map...) Certified
40/// GTID provides information about server representation of the GTID (used
41/// globally in the TC) and group representation of the GTID (group gtid). Other
42/// information used in the code and aggregated inside of this class is: type of
43/// the certified GTID, certification result (negative/positive/negative-error)
44/// and information whether this GTID is local to the current server performing
45/// certification
47 public:
48 /// @brief Constructs Certified_gtid object
49 /// @param server_gtid GTID as seen by server (global)
50 /// @param group_gtid GTID as seen by group (local to group)
51 /// @param is_gtid_specified True if GTID is specified
52 /// @param is_local pass true if transaction originates from this server
53 /// @param cert_result Obtained certification result for transaction
55 const Gtid &server_gtid, const Gtid &group_gtid, bool is_gtid_specified,
56 bool is_local,
58 /// @brief Constructor, sets default gtids
59 /// @param is_gtid_specified True if GTID is specified
60 /// @param is_local pass true if transaction originates from this server
61 Certified_gtid(bool is_gtid_specified, bool is_local);
62 /// @brief Copying constructor
63 /// @param src Pattern to be copied from
64 Certified_gtid(const Certified_gtid &src) = default;
65 /// @brief Assignment operator
66 /// @param src Pattern to be copied from
67 /// @return Reference to this object
68 Certified_gtid &operator=(const Certified_gtid &src) = default;
69
70 /// @brief Returns server representation of the GTID (global used in binlog)
71 /// @return Server representation of the GTID (global used in binlog)
72 const Gtid &get_server_gtid() const;
73
74 /// @brief Accesses Group representation of the GTID
75 /// @return Group representation of the GTID
76 const Gtid &get_group_gtid() const;
77
78 /// @brief Certification result accessor
79 /// @return Certification result
81 /// @brief Checks whether transaction originates from this server
82 /// @return true if transaction originates from this server
83 bool is_local() const;
84
85 /// @brief Returns true in case certified GTID was a specified GTID
86 bool is_specified_gtid() const;
87
88 private:
89 Gtid m_server_gtid; ///< Global representation of the GTID
90 Gtid m_group_gtid; ///< group representation gtid the way gtid is seen by
91 ///< the group
92 /// Indication whether this is a local GTID
93 bool m_is_local = true;
94 /// True if GTID was specified before certification
95 bool m_is_gtid_specified = false;
96 /// Certification result obtained from the certify function
98};
99
100} // namespace gr
101
102#endif // GR_CERTIFICATION_CERTIFIED_GTID_INCLUDED
Class that aggregates important information about already certified gtid.
Definition: certified_gtid.h:46
const Gtid & get_group_gtid() const
Accesses Group representation of the GTID.
Definition: certified_gtid.cc:46
Gtid m_server_gtid
Global representation of the GTID.
Definition: certified_gtid.h:89
bool m_is_local
Indication whether this is a local GTID.
Definition: certified_gtid.h:93
Gtid m_group_gtid
group representation gtid the way gtid is seen by the group
Definition: certified_gtid.h:90
Certified_gtid(const Certified_gtid &src)=default
Copying constructor.
Certification_result m_cert
Certification result obtained from the certify function.
Definition: certified_gtid.h:97
Certified_gtid(const Gtid &server_gtid, const Gtid &group_gtid, bool is_gtid_specified, bool is_local, const Certification_result &cert_result=Certification_result::negative)
Constructs Certified_gtid object.
Definition: certified_gtid.cc:29
bool is_local() const
Checks whether transaction originates from this server.
Definition: certified_gtid.cc:54
const Gtid & get_server_gtid() const
Returns server representation of the GTID (global used in binlog)
Definition: certified_gtid.cc:44
bool is_specified_gtid() const
Returns true in case certified GTID was a specified GTID.
Definition: certified_gtid.cc:52
const Certification_result & get_cert_result() const
Certification result accessor.
Definition: certified_gtid.cc:48
Certified_gtid & operator=(const Certified_gtid &src)=default
Assignment operator.
bool m_is_gtid_specified
True if GTID was specified before certification.
Definition: certified_gtid.h:95
Definition: group_replication_priv.h:44
Certification_result
Represents result of certification function.
Definition: certification_result.h:30
TODO: Move this structure to mysql/binlog/event/control_events.h when we start using C++11.
Definition: rpl_gtid.h:1100