MySQL 8.4.2
Source Code Documentation
gcs_statistics_interface.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 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 GCS_STATISTICS_INTERFACE_INCLUDED
25#define GCS_STATISTICS_INTERFACE_INCLUDED
26
27#include <stdint.h>
28#include <list>
29#include <string>
30
31/**
32 * @brief Container struct that represents a single node suspicious.
33 *
34 * It is represented by two fields:
35 * - A node address in GCS format (ip:port)
36 * - The number of suspicious that this node had
37 */
39 std::string m_node_address{};
41};
42
43/**
44 @class Gcs_statistics_interface
45
46 This interface represents all statistics that a binding implementation should
47 provide.
48*/
50 public:
51 /**
52 * @brief Sum of all proposals that were initiated and terminated in this
53 * node.
54 *
55 * @return uint64_t the value of all sucessful proposal rounds
56 */
57 virtual uint64_t get_all_sucessful_proposal_rounds() const = 0;
58
59 /**
60 * @brief Sum of all empty proposal rounds that were initiated and terminated
61 * in this node.
62 *
63 * @return uint64_t the value of empty proposal rounds
64 */
65 virtual uint64_t get_all_empty_proposal_rounds() const = 0;
66
67 /**
68 * @brief Sum of all socket-level bytes that were sent to all group nodes
69 * originating on this node. Socket-level bytes mean that we will report
70 * more data here than in the sent messages, because they are multiplexed
71 * and sent to each member.
72 *
73 * As an example, if we have a group with 3 members and we send a 100 bytes
74 * message, this value will account for 300 bytes, since we send 100 bytes
75 * to each node.
76 *
77 * @return uint64_t the value of all bytes sent
78 */
79 virtual uint64_t get_all_bytes_sent() const = 0;
80
81 /**
82 * @brief The sum of elapsed time of all consensus rounds started and finished
83 * in this node. Togheter with count_all_consensus_proposals, we can identify
84 * if the individual consensus time has a trend of going up, thus signaling
85 * a possible problem.
86 *
87 * @return unsigned long long the aggregated value of all proposal times
88 */
89 virtual unsigned long long get_cumulative_proposal_time() const = 0;
90
91 /**
92 * @brief A list of pairs between a group member address and the number of
93 * times the local node has seen it as suspected.
94 *
95 * It contains all the suspicious from all nodes that belong or belonged to
96 * the group. This means that it might contain MORE information that just
97 * the current members. It also only contains ONLY the members that were
98 * UNREACHABLE in any given moment. Any member that was never faulty, will
99 * not be presented in this list.
100 *
101 * Any client calling this API must filter out or add in any information
102 * that finds suitable to present to an end user.
103 */
105 std::list<Gcs_node_suspicious> &suspicious) const = 0;
106
107 /**
108 * @brief The number of full 3-Phase PAXOS that this node initiated. If this
109 * number grows, it means that at least of the node is having issues
110 * answering to Proposals, either by slowliness or network issues.
111 * Use togheter with count_member_failure_suspicions to try and do some
112 * diagnose.
113 *
114 * @return uint64_t the value of all 3-phase PAXOS runs
115 */
116 virtual uint64_t get_all_full_proposal_count() const = 0;
117
118 /**
119 * @brief The number of high-level messages that this node sent to the group.
120 * These messages are the ones the we receive via the API to be proposed
121 * to the group. XCom has a batching mechanism, that will gather these
122 * messages and propose them all togheter. This will acocunt the number
123 * of message before being batched.
124 *
125 * @return uint64_t the value for all messages sent
126 */
127 virtual uint64_t get_all_messages_sent() const = 0;
128
129 /**
130 * @brief The sum of all socket-level bytes that were received to from group
131 * nodes having as a destination this node.
132 *
133 * @return uint64_t the value for all message bytes received
134 */
135 virtual uint64_t get_all_message_bytes_received() const = 0;
136
137 /**
138 * @brief The time in which our last consensus proposal was approved. Reported
139 * in a timestamp format. This is an indicator if the group is halted or
140 * making slow progress.
141 *
142 * @return unsigned long long the timestamp value of the last proposal round
143 */
144 virtual unsigned long long get_last_proposal_round_time() const = 0;
145
146 virtual ~Gcs_statistics_interface() = default;
147};
148
149#endif // GCS_STATISTICS_INTERFACE_INCLUDED
This interface represents all statistics that a binding implementation should provide.
Definition: gcs_statistics_interface.h:49
virtual uint64_t get_all_empty_proposal_rounds() const =0
Sum of all empty proposal rounds that were initiated and terminated in this node.
virtual uint64_t get_all_message_bytes_received() const =0
The sum of all socket-level bytes that were received to from group nodes having as a destination this...
virtual unsigned long long get_last_proposal_round_time() const =0
The time in which our last consensus proposal was approved.
virtual uint64_t get_all_messages_sent() const =0
The number of high-level messages that this node sent to the group.
virtual ~Gcs_statistics_interface()=default
virtual uint64_t get_all_bytes_sent() const =0
Sum of all socket-level bytes that were sent to all group nodes originating on this node.
virtual void get_suspicious_count(std::list< Gcs_node_suspicious > &suspicious) const =0
A list of pairs between a group member address and the number of times the local node has seen it as ...
virtual unsigned long long get_cumulative_proposal_time() const =0
The sum of elapsed time of all consensus rounds started and finished in this node.
virtual uint64_t get_all_full_proposal_count() const =0
The number of full 3-Phase PAXOS that this node initiated.
virtual uint64_t get_all_sucessful_proposal_rounds() const =0
Sum of all proposals that were initiated and terminated in this node.
Container struct that represents a single node suspicious.
Definition: gcs_statistics_interface.h:38
uint64_t m_node_suspicious_count
Definition: gcs_statistics_interface.h:40
std::string m_node_address
Definition: gcs_statistics_interface.h:39