MySQL 9.1.0
Source Code Documentation
applier_metrics_stub.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
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 CS_DUMMY_APPLIER_METRICS_AGGREGATOR_H
25#define CS_DUMMY_APPLIER_METRICS_AGGREGATOR_H
26
29
30namespace cs::apply::instruments {
31
32/// @brief Class that intends to be a dummy end point for applier metrics
34 public:
35 /// @brief Starts the timer when the applier metrics collection began.
36 /// Sets the state to running.
37 /// This can be queried later to know for how long time the stats have been
38 /// collected, i.e., the duration.
39 void start_applier_timer() override;
40
41 /// @brief Calculates the total time the applier ran.
42 /// Sets the state to not running
43 /// Sums to time since start to the total running time
44 void stop_applier_timer() override;
45
46 /// @brief Gets the time point when the metric timer started.
47 /// @return The time point since the collection of statistics started.
48 int64_t get_last_applier_start_micros() const override;
49
50 /// @brief Returns the total time the applier was running
51 /// @return Amount of time the applier threads were running for this channel
52 int64_t get_total_execution_time() const override;
53
54 /// @brief increment the number of transactions committed.
55 /// @param amount the amount of transactions to increment.
56 void inc_transactions_committed_count(int64_t amount) override;
57
58 /// @brief Gets the number of transactions committed.
59 /// @return the number of transactions committed.
60 int64_t get_transactions_committed_count() const override;
61
62 /// @brief increment the number of transactions pending.
63 /// @param amount the amount of transactions to increment.
64 void inc_transactions_received_count(int64_t amount) override;
65
66 /// @brief Gets the number of transactions pending.
67 /// @return the number of transactions waiting execution.
68 int64_t get_transactions_received_count() const override;
69
70 /// @brief increment the size of transactions committed.
71 /// @param amount the size amount to increment.
72 void inc_transactions_committed_size_sum(int64_t amount) override;
73
74 /// @brief Gets the total sum of the size of committed transactions
75 /// @return the total size of committed transactions
76 int64_t get_transactions_committed_size_sum() const override;
77
78 /// @brief increment the pending size of queued transactions.
79 /// @param amount the size amount to increment.
80 void inc_transactions_received_size_sum(int64_t amount) override;
81
82 /// @brief Gets the pending size sum of queued transactions
83 /// @return the exectuted size of pending transactions
84 int64_t get_transactions_received_size_sum() const override;
85
86 /// @brief increment the number of events scheduled by a given amount.
87 /// @param v the amount of events to increment.
88 void inc_events_committed_count(int64_t v) override;
89
90 /// @brief Gets the number of events scheduled.
91 /// @return the number of events scheduled.
92 int64_t get_events_committed_count() const override;
93
94 /// @brief Resets the statistics to zero.
95 void reset() override;
96
97 /// @return false.
98 bool is_after_metrics_breakpoint() const override;
99
100 /// Do nothing.
101 void set_metrics_breakpoint(const char *relay_log_filename) override;
102
103 /// Do nothing
104 void check_metrics_breakpoint(const char *relay_log_filename) override;
105
106 /// @brief Returns time metrics for waits on work from the source
107 /// @return a Time_based_metric_interface object that contains metric
108 /// information on a wait
110
111 /// @brief Returns time metrics for waits on available workers
112 /// @return a Time_based_metric_interface object that contains metric
113 /// information on a wait
115
116 /// @brief Returns time metrics for waits on transaction dependecies on
117 /// workers
118 /// @return a Time_based_metric_interface object that contains metric
119 /// information on a wait
121 override;
122
123 /// @brief Returns time metrics for waits when a worker queue exceeds max
124 /// memory
125 /// @return a Time_based_metric_interface object that contains metric
126 /// information on a wait
129
130 /// @brief Returns time metrics for waits when the worker queues are full
131 /// @return a Time_based_metric_interface object that contains metric
132 /// information on a wait
134
135 /// @brief Returns time metrics for relay log read wait times
136 /// @return a Time_based_metric_interface object that contains metric
137 /// information on a wait
139 override;
140
141 /// @brief Increments the stored values for the commit order metrics.
142 /// @param count The count for commit order waits
143 /// @param time The time waited on commit order
145 int64_t time) override;
146
147 /// @brief Gets the stored number of times we waited on committed order
148 /// @return the stored number of commit order waits
149 int64_t get_number_of_waits_on_commit_order() const override;
150
151 /// @brief Gets the stored summed time waited on commit order
152 /// @return the stored sum of the time waited on commit
153 int64_t get_wait_time_on_commit_order() const override;
154
155 private:
156 /// @brief Tracks the number and time waited for transactions to apply
158
159 // wait because no workers available ---
160
161 /// @brief Tracks the number and time waited for transactions to apply
163
164 // waits for transaction dependency ---
165
166 /// @brief Tracks the number and time waited for transaction dependencies
168
169 // waits because worker queues memory exceeds max ---
170
171 /// @brief Tracks the number and time waited for transaction dependencies
173
174 // wait because worker queues are full ---
175
176 /// @brief Tracks the number and time waited for transaction dependencies
178
179 // Time spent reading from the relay log ---
180
181 /// @brief Tracks the number and time waited for transaction dependencies
183};
184} // namespace cs::apply::instruments
185
186#endif /* CS_DUMMY_APPLIER_METRICS_AGGREGATOR_H */
Abstract class for time based metrics implementations.
Definition: time_based_metric_interface.h:30
Class that intends to be a dummy end point for time metrics.
Definition: time_based_metric_stub.h:30
This abstract class is an interface for classes that contain replication applier data as counters and...
Definition: applier_metrics_interface.h:36
Class that intends to be a dummy end point for applier metrics.
Definition: applier_metrics_stub.h:33
Time_based_metric_interface & get_worker_queues_memory_exceeds_max_wait_metric() override
Returns time metrics for waits when a worker queue exceeds max memory.
Definition: applier_metrics_stub.cc:90
int64_t get_wait_time_on_commit_order() const override
Gets the stored summed time waited on commit order.
Definition: applier_metrics_stub.cc:111
void inc_transactions_committed_count(int64_t amount) override
increment the number of transactions committed.
Definition: applier_metrics_stub.cc:40
void inc_transactions_received_size_sum(int64_t amount) override
increment the pending size of queued transactions.
Definition: applier_metrics_stub.cc:58
int64_t get_total_execution_time() const override
Returns the total time the applier was running.
Definition: applier_metrics_stub.cc:38
int64_t get_events_committed_count() const override
Gets the number of events scheduled.
Definition: applier_metrics_stub.cc:66
void reset() override
Resets the statistics to zero.
Definition: applier_metrics_stub.cc:28
void inc_transactions_committed_size_sum(int64_t amount) override
increment the size of transactions committed.
Definition: applier_metrics_stub.cc:52
Time_based_metric_stub m_wait_due_to_worker_queue_full
Tracks the number and time waited for transaction dependencies.
Definition: applier_metrics_stub.h:177
Time_based_metric_stub m_wait_for_work_from_source
Tracks the number and time waited for transactions to apply.
Definition: applier_metrics_stub.h:157
Time_based_metric_interface & get_transaction_dependency_wait_metric() override
Returns time metrics for waits on transaction dependecies on workers.
Definition: applier_metrics_stub.cc:85
void start_applier_timer() override
Starts the timer when the applier metrics collection began.
Definition: applier_metrics_stub.cc:30
int64_t get_transactions_committed_size_sum() const override
Gets the total sum of the size of committed transactions.
Definition: applier_metrics_stub.cc:54
int64_t get_transactions_committed_count() const override
Gets the number of transactions committed.
Definition: applier_metrics_stub.cc:42
Time_based_metric_interface & get_worker_queues_full_wait_metric() override
Returns time metrics for waits when the worker queues are full.
Definition: applier_metrics_stub.cc:95
int64_t get_transactions_received_count() const override
Gets the number of transactions pending.
Definition: applier_metrics_stub.cc:48
bool is_after_metrics_breakpoint() const override
Definition: applier_metrics_stub.cc:68
void stop_applier_timer() override
Calculates the total time the applier ran.
Definition: applier_metrics_stub.cc:32
Time_based_metric_interface & get_work_from_source_wait_metric() override
Returns time metrics for waits on work from the source.
Definition: applier_metrics_stub.cc:75
void inc_events_committed_count(int64_t v) override
increment the number of events scheduled by a given amount.
Definition: applier_metrics_stub.cc:64
void check_metrics_breakpoint(const char *relay_log_filename) override
Do nothing.
Definition: applier_metrics_stub.cc:72
Time_based_metric_interface & get_workers_available_wait_metric() override
Returns time metrics for waits on available workers.
Definition: applier_metrics_stub.cc:80
Time_based_metric_stub m_wait_due_to_worker_queues_memory_exceeds_max
Tracks the number and time waited for transaction dependencies.
Definition: applier_metrics_stub.h:172
Time_based_metric_interface & get_time_to_read_from_relay_log_metric() override
Returns time metrics for relay log read wait times.
Definition: applier_metrics_stub.cc:100
int64_t get_transactions_received_size_sum() const override
Gets the pending size sum of queued transactions.
Definition: applier_metrics_stub.cc:60
void inc_commit_order_wait_stored_metrics(int64_t count, int64_t time) override
Increments the stored values for the commit order metrics.
Definition: applier_metrics_stub.cc:104
void set_metrics_breakpoint(const char *relay_log_filename) override
Do nothing.
Definition: applier_metrics_stub.cc:70
int64_t get_last_applier_start_micros() const override
Gets the time point when the metric timer started.
Definition: applier_metrics_stub.cc:34
Time_based_metric_stub m_wait_for_worker_available
Tracks the number and time waited for transactions to apply.
Definition: applier_metrics_stub.h:162
int64_t get_number_of_waits_on_commit_order() const override
Gets the stored number of times we waited on committed order.
Definition: applier_metrics_stub.cc:107
Time_based_metric_stub m_time_to_read_from_relay_log
Tracks the number and time waited for transaction dependencies.
Definition: applier_metrics_stub.h:182
Time_based_metric_stub m_wait_for_transaction_dependency
Tracks the number and time waited for transaction dependencies.
Definition: applier_metrics_stub.h:167
void inc_transactions_received_count(int64_t amount) override
increment the number of transactions pending.
Definition: applier_metrics_stub.cc:46
static int count
Definition: myisam_ftdump.cc:45
Definition: applier_metrics.cc:27