MySQL 9.1.0
Source Code Documentation
|
This abstract class is an interface for classes that contain replication applier data as counters and wait times. More...
#include <applier_metrics_interface.h>
Public Member Functions | |
virtual | ~Applier_metrics_interface ()=default |
virtual void | start_applier_timer ()=0 |
Starts the timer when the applier metrics collection began. More... | |
virtual void | stop_applier_timer ()=0 |
Calculates the total time the applier ran. More... | |
virtual int64_t | get_last_applier_start_micros () const =0 |
Gets the time point when the metric timer started. More... | |
virtual int64_t | get_total_execution_time () const =0 |
Returns the total time the applier was running. More... | |
virtual void | inc_transactions_committed_count (int64_t amount)=0 |
increment the number of transactions committed. More... | |
virtual int64_t | get_transactions_committed_count () const =0 |
Gets the number of transactions committed. More... | |
virtual void | inc_transactions_received_count (int64_t amount)=0 |
increment the number of transactions received. More... | |
virtual int64_t | get_transactions_received_count () const =0 |
Gets the number of transactions received. More... | |
virtual void | inc_transactions_committed_size_sum (int64_t amount)=0 |
increment the size of transactions committed. More... | |
virtual int64_t | get_transactions_committed_size_sum () const =0 |
Gets the total sum of the size of committed transactions. More... | |
virtual void | inc_transactions_received_size_sum (int64_t amount)=0 |
increment the pending size of queued transactions. More... | |
virtual int64_t | get_transactions_received_size_sum () const =0 |
Gets the pending size sum of queued transactions. More... | |
virtual void | inc_events_committed_count (int64_t amount)=0 |
increment the number of events scheduled by a given amount. More... | |
virtual int64_t | get_events_committed_count () const =0 |
Gets the number of events scheduled. More... | |
virtual void | reset ()=0 |
Resets the statistics to zero. More... | |
virtual bool | is_after_metrics_breakpoint () const =0 |
Query whether the size/count of received transactions has been completely computed. More... | |
virtual void | set_metrics_breakpoint (const char *relay_log_filename)=0 |
If the metrics breakpoint has not been set yet, set it to the given filename. More... | |
virtual void | check_metrics_breakpoint (const char *relay_log_filename)=0 |
If the metrics breakpoint has been set and is equal to the given filename, remember that we are now after the metrics breakpoint, so that subsequent calls to is_after_metrics_breakpoint return true. More... | |
virtual Time_based_metric_interface & | get_work_from_source_wait_metric ()=0 |
Returns time metrics for waits on work from the source. More... | |
virtual Time_based_metric_interface & | get_workers_available_wait_metric ()=0 |
Returns time metrics for waits on available workers. More... | |
virtual Time_based_metric_interface & | get_transaction_dependency_wait_metric ()=0 |
Returns time metrics for waits on transaction dependecies on workers. More... | |
virtual Time_based_metric_interface & | get_worker_queues_memory_exceeds_max_wait_metric ()=0 |
Returns time metrics for waits when a worker queue exceeds max memory. More... | |
virtual Time_based_metric_interface & | get_worker_queues_full_wait_metric ()=0 |
Returns time metrics for waits when the worker queues are full. More... | |
virtual Time_based_metric_interface & | get_time_to_read_from_relay_log_metric ()=0 |
Returns time metrics for relay log read wait times. More... | |
virtual void | inc_commit_order_wait_stored_metrics (int64_t count, int64_t time)=0 |
Increments the stored values for the commit order metrics. More... | |
virtual int64_t | get_number_of_waits_on_commit_order () const =0 |
Gets the stored number of times we waited on committed order. More... | |
virtual int64_t | get_wait_time_on_commit_order () const =0 |
Gets the stored summed time waited on commit order. More... | |
This abstract class is an interface for classes that contain replication applier data as counters and wait times.
|
virtualdefault |
|
pure virtual |
If the metrics breakpoint has been set and is equal to the given filename, remember that we are now after the metrics breakpoint, so that subsequent calls to is_after_metrics_breakpoint
return true.
This function must only be called by the coordinator thread.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the number of events scheduled.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the time point when the metric timer started.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the stored number of times we waited on committed order.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Returns time metrics for relay log read wait times.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Returns the total time the applier was running.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Returns time metrics for waits on transaction dependecies on workers.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the number of transactions committed.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the total sum of the size of committed transactions.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the number of transactions received.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the pending size sum of queued transactions.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Gets the stored summed time waited on commit order.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Returns time metrics for waits on work from the source.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Returns time metrics for waits when the worker queues are full.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Returns time metrics for waits when a worker queue exceeds max memory.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Returns time metrics for waits on available workers.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Increments the stored values for the commit order metrics.
count | The count for commit order waits |
time | The time waited on commit order |
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
increment the number of events scheduled by a given amount.
amount | the amount of events to increment. |
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
increment the number of transactions committed.
amount | the amount of transactions to increment. |
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
increment the size of transactions committed.
amount | the size amount to increment. |
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
increment the number of transactions received.
amount | the amount of transactions to increment. |
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
increment the pending size of queued transactions.
amount | the size amount to increment. |
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Query whether the size/count of received transactions has been completely computed.
Among other things, we track track the count and size of pending transactions, i.e., the transactions that are received but not yet committed. Internally, in this class, we track these metrics using two sets of transactions: the size/count of committed transactions and the size/count of received transactions. The size/count of pending transactions can be computed as the difference between the two.
The correct initial value for the received transactions would be the size of all not yet applied transactions in the relay log. To get that metric correct at the time the server starts (or the time the user enables collecting metrics), we would have to scan the relay logs. But that can be too expensive. So instead we just take a note that the metric is not yet known. Until the metric is known, we display the value as NULL to the user. Internally, we compute the initial value progressively, while applying those transactions.
We define the metrics breakpoint as the point in the relay log such that when the point is reached we know that the size/count of received transactions is completely computed. The metrics breakpoint is (the start of) the first relay log the receiver writes to.
Sizes/counts of transactions which appear before the metrics breakpoint are incremented when those transactions commit. When the metrics breakpoint is reached, the coordinator waits for preceding transactions to commit, and then declares that the metrics have been computed. Sizes/counts of transactions which appear after the metrics breakpoint are incremented when those transactions are fully received and written to the relay log.
When the receiver starts, it uses set_metrics_breakpoint
to set the metric breakpoint to the relay log in which it writes the first event.
It is guaranteed that the applier, when it reaches first relay log that was received after the receiver thread started, waits for preceding transactions to complete. It does this while applying the Format_description_log_event from the source. Therefore, after any such wait, it uses check_metrics_breakpoint
to checks if the current relay log is the metrics breakpoint. If that is the case, the internal flag m_is_after_metrics_breakpoint
is set to true, and this makes subsequent calls to is_after_metrics_breakpoint
return true.
When the coordinator schedules an event to a worker, it propagates is_after_metrics_breakpoint
to the worker, through Slave_job_item::m_is_after_metrics_breakpoint
. When the worker commits the transaction, it checks the flag. If the flag is false, it increments the count/size of received transactions.
This function may be called from many different threads.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Resets the statistics to zero.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
If the metrics breakpoint has not been set yet, set it to the given filename.
This function must only be called by the receiver thread.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Starts the timer when the applier metrics collection began.
Sets the state to running. This can be queried later to know for how long time the stats have been collected, i.e., the duration.
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.
|
pure virtual |
Calculates the total time the applier ran.
Sets the state to not running Sums to time since start to the total running time
Implemented in cs::apply::instruments::Applier_metrics, and cs::apply::instruments::Applier_metrics_stub.