MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
mta_worker_metrics.h
Go to the documentation of this file.
1// Copyright (c) 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 CHANGESTREAMS_APPLY_METRICS_MTA_WORKER_METRICS_H
25#define CHANGESTREAMS_APPLY_METRICS_MTA_WORKER_METRICS_H
26#include <atomic>
27#include "time_based_metric.h"
28#include "worker_metrics.h"
29
30namespace cs::apply::instruments {
31
32/// @brief This class contains metrics transaction
33/// execution in replica MTA workers
35 public:
36 /// @brief Copies stats from the given object into this one.
37 /// @param other the object to copy the stats from.
39
40 /// @brief Resets the instruments on this instance.
41 void reset() override;
42
43 /// @brief Returns the type of the currently being processed transaction
44 /// @return If the type is unknown, DML or DDL
46
47 /// @brief Set the type for the transaction being currently processed
48 /// @param type_info what is the type: UNKONWN, DML or DDL
49 void set_transaction_type(Transaction_type_info type_info) override;
50
51 /// @brief set the full size of the ongoing transaction.
52 /// @param amount new size
53 void set_transaction_ongoing_full_size(int64_t amount) override;
54
55 /// @brief Gets the full size of the ongoing transaction
56 /// @return the total size of the ongoing transaction
57 int64_t get_transaction_ongoing_full_size() const override;
58
59 /// @brief increment the executed size of the ongoing transaction.
60 /// @param amount the size amount to increment.
61 void inc_transaction_ongoing_progress_size(int64_t amount) override;
62
63 /// @brief Resets the the executed size of the ongoing transaction to 0
65
66 /// @brief Gets the executed size of the ongoing transaction
67 /// @return the exectuted size of the ongoing transaction
68 int64_t get_transaction_ongoing_progress_size() const override;
69
70 /// @brief Return time metric for waits on commit order.
71 /// @return a Time_based_metric_interface object that contains metric
72 /// information on a wait
74
75 private:
76 /// @brief The type of the transactions being handled
77 std::atomic<Transaction_type_info> m_transaction_type{
79
80 /// @brief The number of time waited for commit order
82
83 /// @brief Holds the total full size of the transaction now ongoing
84 std::atomic_int64_t m_transaction_ongoing_full_size{0};
85
86 /// @brief Holds the executed event's size of the transaction now ongoing
88};
89} // namespace cs::apply::instruments
90
91#endif /* CHANGESTREAMS_APPLY_METRICS_MTA_WORKER_METRICS_H */
Abstract class for time based metrics implementations.
Definition: time_based_metric_interface.h:32
Class that encodes how much time we waited for something.
Definition: time_based_metric.h:31
This class contains metrics transaction execution in replica MTA workers.
Definition: mta_worker_metrics.h:34
std::atomic_int64_t m_transaction_ongoing_full_size
Holds the total full size of the transaction now ongoing.
Definition: mta_worker_metrics.h:84
Time_based_metric_interface & get_waits_due_to_commit_order() override
Return time metric for waits on commit order.
Definition: mta_worker_metrics.cc:71
void reset_transaction_ongoing_progress_size() override
Resets the the executed size of the ongoing transaction to 0.
Definition: mta_worker_metrics.cc:62
void reset() override
Resets the instruments on this instance.
Definition: mta_worker_metrics.cc:38
void inc_transaction_ongoing_progress_size(int64_t amount) override
increment the executed size of the ongoing transaction.
Definition: mta_worker_metrics.cc:58
Mta_worker_metrics & operator=(const Mta_worker_metrics &other)
Copies stats from the given object into this one.
Definition: mta_worker_metrics.cc:28
void set_transaction_ongoing_full_size(int64_t amount) override
set the full size of the ongoing transaction.
Definition: mta_worker_metrics.cc:50
std::atomic_int64_t m_transaction_ongoing_progress_size
Holds the executed event's size of the transaction now ongoing.
Definition: mta_worker_metrics.h:87
void set_transaction_type(Transaction_type_info type_info) override
Set the type for the transaction being currently processed.
Definition: mta_worker_metrics.cc:45
std::atomic< Transaction_type_info > m_transaction_type
The type of the transactions being handled.
Definition: mta_worker_metrics.h:77
int64_t get_transaction_ongoing_progress_size() const override
Gets the executed size of the ongoing transaction.
Definition: mta_worker_metrics.cc:66
Worker_metrics::Transaction_type_info get_transaction_type() const override
Returns the type of the currently being processed transaction.
Definition: mta_worker_metrics.cc:41
int64_t get_transaction_ongoing_full_size() const override
Gets the full size of the ongoing transaction.
Definition: mta_worker_metrics.cc:54
Time_based_metric m_waits_due_to_commit_order
The number of time waited for commit order.
Definition: mta_worker_metrics.h:81
Abstract class for classes that contain metrics related to transaction execution in applier workers.
Definition: worker_metrics.h:34
Transaction_type_info
This class helps signaling a transactions as DDL or DML.
Definition: worker_metrics.h:37
Definition: applier_metrics.cc:27