MySQL 9.1.0
Source Code Documentation
worker_metrics.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; witho`ut 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_WORKER_METRICS_H
25#define CS_WORKER_METRICS_H
26
27#include <cstdint> // int64_t
28
29namespace cs::apply::instruments {
30
31/// @brief Abstract class for classes that contain metrics related to
32/// transaction execution in applier workers
34 public:
35 /// @brief This class helps signaling a transactions as DDL or DML
37 UNKNOWN, // The transaction type is not yet known
38 DML, // It is a DML transaction
39 DDL // It is a DDL transaction
40 };
41
42 virtual ~Worker_metrics() = default;
43
44 /// @brief Resets the instruments on this instance.
45 virtual void reset() = 0;
46
47 /// @brief Returns the type of the currently being processed transaction
48 /// @return If the type is unknown, DML or DDL
50
51 /// @brief Set the type for the transaction being currently processed
52 /// @param type_info what is the type: UNKONWN, DML or DDL
53 virtual void set_transaction_type(Transaction_type_info type_info) = 0;
54
55 /// @brief set the full size of the ongoing transaction.
56 /// @param amount new size
57 virtual void set_transaction_ongoing_full_size(int64_t amount) = 0;
58
59 /// @brief Gets the full size of the ongoing transaction
60 /// @return the total size of the ongoing transaction
61 virtual int64_t get_transaction_ongoing_full_size() const = 0;
62
63 /// @brief increment the executed size of the ongoing transaction.
64 /// @param amount the size amount to increment.
65 virtual void inc_transaction_ongoing_progress_size(int64_t amount) = 0;
66
67 /// @brief Resets the the executed size of the ongoing transaction to 0
69
70 /// @brief Gets the executed size of the ongoing transaction
71 /// @return the exectuted size of the ongoing transaction
72 virtual int64_t get_transaction_ongoing_progress_size() const = 0;
73
74 /// @brief Gets the total time waited on commit order
75 /// @return the sum of the time waited on commit
76 virtual int64_t get_wait_time_on_commit_order() const = 0;
77
78 /// @brief Increments the number of times waited
79 virtual void inc_waited_time_on_commit_order(unsigned long amount) = 0;
80
81 /// @brief Get the number of time waiting on commit order
82 /// @return the counter of waits on commit order
83 virtual int64_t get_number_of_waits_on_commit_order() const = 0;
84
85 /// @brief Increments the number of times waited
87};
88} // namespace cs::apply::instruments
89
90#endif /* CS_WORKER_METRICS_H */
Abstract class for classes that contain metrics related to transaction execution in applier workers.
Definition: worker_metrics.h:33
virtual int64_t get_transaction_ongoing_progress_size() const =0
Gets the executed size of the ongoing transaction.
virtual void inc_waited_time_on_commit_order(unsigned long amount)=0
Increments the number of times waited.
virtual void set_transaction_ongoing_full_size(int64_t amount)=0
set the full size of the ongoing transaction.
virtual void set_transaction_type(Transaction_type_info type_info)=0
Set the type for the transaction being currently processed.
virtual void inc_transaction_ongoing_progress_size(int64_t amount)=0
increment the executed size of the ongoing transaction.
virtual int64_t get_number_of_waits_on_commit_order() const =0
Get the number of time waiting on commit order.
virtual void reset_transaction_ongoing_progress_size()=0
Resets the the executed size of the ongoing transaction to 0.
virtual int64_t get_wait_time_on_commit_order() const =0
Gets the total time waited on commit order.
Transaction_type_info
This class helps signaling a transactions as DDL or DML.
Definition: worker_metrics.h:36
virtual void inc_number_of_waits_on_commit_order()=0
Increments the number of times waited.
virtual void reset()=0
Resets the instruments on this instance.
virtual Transaction_type_info get_transaction_type() const =0
Returns the type of the currently being processed transaction.
virtual int64_t get_transaction_ongoing_full_size() const =0
Gets the full size of the ongoing transaction.
Definition: applier_metrics.cc:27