MySQL 8.0.39
Source Code Documentation
Mysql::Tools::Dump::Abstract_progress_watcher Class Referenceabstract

Gathers information about progress of current dump progress and format messages on progress.Also it should expose API for receiving processed progress information: collected objects and rows information along with time elapsed, ETA. More...

#include <abstract_progress_watcher.h>

Inheritance diagram for Mysql::Tools::Dump::Abstract_progress_watcher:
[legend]

Classes

class  Progress_data
 

Public Member Functions

void new_chain_created (Item_processing_data *new_chain_process_data) override
 Reports new non-empty chain being created by Chain Maker or new row fetched from table by Table Reader. More...
 
void object_processing_started (Item_processing_data *process_data) override
 Report new object(table, row or any other) was started processing by specified Object Reader, Table Reader, Formatter or Row Formatter. More...
 
void object_processing_ended (Item_processing_data *finished_process_data) override
 Report object(table, row or any other) finished being processed. More...
 
void crawler_completed (I_crawler *crawler) override
 Reports crawler ended enumerating objects and creating chains for them. More...
 
void register_progress_watcher (I_progress_watcher *new_progress_watcher) override
 Add new Progress Watcher to report to. More...
 
uint64 get_id () const override
 Returns an application unique ID of this chain element object. More...
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_chain_element
 ~I_chain_element () override
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_progress_reporter
virtual ~I_progress_reporter ()
 
- Public Member Functions inherited from Mysql::Tools::Dump::Abstract_chain_element
Abstract_chain_elementoperator= (Abstract_chain_element &&other)=delete
 Disable move assignment to avoid Wvirtual-move-assign warning. More...
 

Protected Member Functions

 Abstract_progress_watcher (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator)
 
virtual void process_progress_step (Progress_data &change)=0
 
void item_completion_in_child_callback (Item_processing_data *item_processed) override
 This callback can be requested to be called by child for any object processing. More...
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_chain_element
 Abstract_chain_element (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator)
 
template<typename TType , typename TClass >
bool try_process_task (Item_processing_data *item_to_process, void(TClass::*processing_func)(TType *, Item_processing_data *))
 Process task object with specified function if that task object can be casted to type TType. More...
 
template<typename TType , typename TClass >
bool try_process_task (Item_processing_data *item_to_process, void(TClass::*processing_func)(TType *))
 Process task object with specified function if that task object can be casted to type TType. More...
 
void object_processing_starts (Item_processing_data *item_to_process)
 
Item_processing_dataobject_to_be_processed_in_child (Item_processing_data *current_item_data, I_chain_element *child_chain_element)
 
Item_processing_datanew_task_created (I_dump_task *dump_task_created)
 
Item_processing_datanew_chain_created (Chain_data *new_chain_data, Item_processing_data *parent_processing_data, I_chain_element *child_chain_element)
 
Item_processing_datanew_chain_created (Item_processing_data *current_item_data, I_dump_task *dump_task_created)
 
void object_processing_ends (Item_processing_data *processed_item)
 
uint64 generate_new_object_id ()
 
Simple_id_generatorget_object_id_generator () const
 
void pass_message (const Mysql::Tools::Base::Message_data &message_data)
 Passes message to message callback. More...
 
std::function< bool(const Mysql::Tools::Base::Message_data &)> * get_message_handler () const
 
virtual bool need_callbacks_in_child ()
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_progress_reporter
bool have_progress_watcher ()
 Specifies if have any Progress Watcher registered. More...
 
void report_new_chain_created (Item_processing_data *new_chain_creator)
 Reports new non-empty chain being created by Chain Maker or new row fetched from table by Table Reader. More...
 
void report_object_processing_started (Item_processing_data *process_data)
 Report new object(table, row or any other) was started processing by specified Object Reader, Table Reader, Formatter or Row Formatter. More...
 
void report_object_processing_ended (Item_processing_data *finished_process_data)
 Report object(table, row or any other) finished being processed. More...
 
virtual void report_crawler_completed (I_crawler *crawler)
 Reports crawler ended enumerating objects and creating chains for them. More...
 
void register_progress_watchers_in_child (I_progress_reporter *reporter)
 

Protected Attributes

Progress_data m_total
 
Progress_data m_progress
 
Progress_data m_last_progress
 

Private Member Functions

void progress_changed ()
 Throttles progress changes to be reported to progress_changed() about 1 in second. More...
 

Private Attributes

std::chrono::system_clock::time_point m_last_stage_time
 
std::atomic< int64_t > m_step_countdown
 
std::atomic< int64_t > m_stage_countdown
 
int64 m_last_step_countdown
 

Static Private Attributes

static const int STAGES = 10
 
static const int REPORT_DELAY_MS = 1000
 

Detailed Description

Gathers information about progress of current dump progress and format messages on progress.Also it should expose API for receiving processed progress information: collected objects and rows information along with time elapsed, ETA.

Constructor & Destructor Documentation

◆ Abstract_progress_watcher()

Abstract_progress_watcher::Abstract_progress_watcher ( std::function< bool(const Mysql::Tools::Base::Message_data &)> *  message_handler,
Simple_id_generator object_id_generator 
)
protected

Member Function Documentation

◆ crawler_completed()

void Abstract_progress_watcher::crawler_completed ( I_crawler crawler)
overridevirtual

Reports crawler ended enumerating objects and creating chains for them.

Implements Mysql::Tools::Dump::I_progress_watcher.

◆ get_id()

uint64 Mysql::Tools::Dump::Abstract_progress_watcher::get_id ( ) const
inlineoverridevirtual

Returns an application unique ID of this chain element object.

This helps progress watching with multiple parts of chain during all objects processing.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

◆ item_completion_in_child_callback()

void Mysql::Tools::Dump::Abstract_progress_watcher::item_completion_in_child_callback ( Item_processing_data item_processed)
inlineoverrideprotectedvirtual

This callback can be requested to be called by child for any object processing.

This will be called when the object processing has completed. Note that this function may be called from multiple threads so all implementations must be thread-safe.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

◆ new_chain_created()

void Abstract_progress_watcher::new_chain_created ( Item_processing_data new_chain_process_data)
overridevirtual

Reports new non-empty chain being created by Chain Maker or new row fetched from table by Table Reader.

Called from Crawler or Table Reader.

Implements Mysql::Tools::Dump::I_progress_watcher.

◆ object_processing_ended()

void Abstract_progress_watcher::object_processing_ended ( Item_processing_data finished_process_data)
overridevirtual

Report object(table, row or any other) finished being processed.

In case of table, this does not necessarily mean that all rows were processed. That does not necessarily mean that object was successfully written by Output Writers.

Implements Mysql::Tools::Dump::I_progress_watcher.

◆ object_processing_started()

void Abstract_progress_watcher::object_processing_started ( Item_processing_data process_data)
overridevirtual

Report new object(table, row or any other) was started processing by specified Object Reader, Table Reader, Formatter or Row Formatter.

Reported by these types. Is not reported by queues on enqueue but on dequeue.

Implements Mysql::Tools::Dump::I_progress_watcher.

◆ process_progress_step()

virtual void Mysql::Tools::Dump::Abstract_progress_watcher::process_progress_step ( Progress_data change)
protectedpure virtual

◆ progress_changed()

void Abstract_progress_watcher::progress_changed ( )
private

Throttles progress changes to be reported to progress_changed() about 1 in second.

It uses 10 stages, each 100ms long, in each there is number of iterations to prevent calling std::chrono::system_clock::now() on each function call.

◆ register_progress_watcher()

void Mysql::Tools::Dump::Abstract_progress_watcher::register_progress_watcher ( I_progress_watcher new_progress_watcher)
inlineoverridevirtual

Add new Progress Watcher to report to.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

Member Data Documentation

◆ m_last_progress

Progress_data Mysql::Tools::Dump::Abstract_progress_watcher::m_last_progress
protected

◆ m_last_stage_time

std::chrono::system_clock::time_point Mysql::Tools::Dump::Abstract_progress_watcher::m_last_stage_time
private

◆ m_last_step_countdown

int64 Mysql::Tools::Dump::Abstract_progress_watcher::m_last_step_countdown
private

◆ m_progress

Progress_data Mysql::Tools::Dump::Abstract_progress_watcher::m_progress
protected

◆ m_stage_countdown

std::atomic<int64_t> Mysql::Tools::Dump::Abstract_progress_watcher::m_stage_countdown
private

◆ m_step_countdown

std::atomic<int64_t> Mysql::Tools::Dump::Abstract_progress_watcher::m_step_countdown
private

◆ m_total

Progress_data Mysql::Tools::Dump::Abstract_progress_watcher::m_total
protected

◆ REPORT_DELAY_MS

const int Mysql::Tools::Dump::Abstract_progress_watcher::REPORT_DELAY_MS = 1000
staticprivate

◆ STAGES

const int Mysql::Tools::Dump::Abstract_progress_watcher::STAGES = 10
staticprivate

The documentation for this class was generated from the following files: