![]() |
MySQL 26.7.0
Source Code Documentation
|
Service class for the Change Streams Applier (CSA) More...
#include <csa_service.h>
Public Member Functions | |
| Csa_service () | |
| Constructor. More... | |
| virtual | ~Csa_service () override |
| Destructor. More... | |
| bool | run (Relay_log_info *rli) |
| Synchronous method that runs the channel applier. More... | |
| void | remove (Relay_log_info *rli) |
| Synchronous method that removes data and destroys objects related to the channel. More... | |
| std::size_t | get_workers_number (const char *channel) |
| Obtains the number of workers configured for the channel. More... | |
| std::optional< Session_legacy_stats > | get_session_legacy_stats (const char *channel, std::size_t worker_id) |
| Obtains session legacy statistics kept in the RLI object. More... | |
| std::optional< bool > | has_applied_all_work (const char *channel) |
| Checks whether applier for the channel has applied all of the work and is waiting for more tasks. More... | |
| bool | is_csa_event_applier (const char *channel, unsigned int thread_id) |
| Checks whether CSA contains session with a given THD thread_id. More... | |
| bool | initialize_channel_data (const char *channel, std::size_t channel_unique_id, std::size_t worker_num) |
| This function is used only to initialize channel legacy statistics and to make empty statistics available in case channel was not activated. More... | |
| void | clear_channel_data (const char *channel, bool remove) |
| This function is used only to remove cached channel statistics upon channel deletion. More... | |
| void | stop (const char *channel, bool force_kill) |
| Stops applier now. More... | |
Public Member Functions inherited from mysql::csa::Module | |
| Module (PSI_mutex_key mutex_key, PSI_rwlock_key rwlock_key) | |
| Constructs the module. More... | |
| virtual | ~Module () override |
| Destructor. More... | |
| void | init_locking () |
| Initializes internal locking. More... | |
| bool | init () override |
| Initializes the module. More... | |
| Lock_guard | rdlock () |
| Acquires a read lock on this object. More... | |
| Lock_guard | wrlock () |
| Acquires a write lock on this object. More... | |
| bool | deinit () override |
| Deinitializes the module. More... | |
| bool | is_inited () |
| Checks if the module is initialized. More... | |
Public Member Functions inherited from mysql::csa::Initable | |
| virtual | ~Initable ()=default |
| Destructor. More... | |
Private Member Functions | |
| std::optional< Session_legacy_stats > | get_session_legacy_stats_internal (const char *channel, std::size_t worker_id) |
| Obtains session legacy statistics kept in the RLI object, no lock. More... | |
| bool | do_init () override |
| Initialization. More... | |
| bool | do_deinit () override |
| Deinitialization. More... | |
| void | clean_up_context (const std::string &channel) |
| Helper function to clean up channel data upon destruction. More... | |
Private Attributes | |
| unsigned int | m_kernel_ref_count {0} |
| The number of references (channels), protected with internal lock. More... | |
| std::unordered_map< std::string, Csa_channel > | csa_channels |
| Channel data. More... | |
| std::unordered_map< std::string, std::vector< Session_legacy_stats > > | m_inactive_channel_stats |
| Cached statistics for inactive channels. More... | |
| std::atomic< bool > | m_soft_stop {false} |
| When true, channels will execute soft stop after stop of the channel was requested. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mysql::csa::Module | |
| void | unlock () |
| Unlocks this module. More... | |
Service class for the Change Streams Applier (CSA)
| using mysql::csa::Csa_service::Clock_ptr = std::shared_ptr<mysql::scheduler::Scheduler_clock> |
Shared pointer to Scheduler_clock.
Clock type used in the scheduler.
Dependency tracker type.
Shared pointer to Dependency_tracker.
Schedule factory type.
| using mysql::csa::Csa_service::Schedule_factory_ptr = std::shared_ptr<Schedule_factory> |
Shared pointer to Schedule_factory.
| using mysql::csa::Csa_service::Scheduler_ptr = std::shared_ptr<Scheduler_type> |
Shared pointer to Scheduler_type.
Scheduler type.
Shared pointer to Session_service.
Result type for tasks.
| using mysql::csa::Csa_service::Thread_pool = mysql::scheduler::Thread_pool<Task_result, mysql::csa::tune::scheduler_tp_queue_size> |
Thread pool type.
| using mysql::csa::Csa_service::Thread_pool_ptr = std::shared_ptr<Thread_pool> |
Shared pointer to Thread_pool.
| mysql::csa::Csa_service::Csa_service | ( | ) |
Constructor.
|
overridevirtual |
Destructor.
|
private |
Helper function to clean up channel data upon destruction.
| channel | Channel identifier |
| void mysql::csa::Csa_service::clear_channel_data | ( | const char * | channel, |
| bool | remove | ||
| ) |
This function is used only to remove cached channel statistics upon channel deletion.
| channel | Channel name |
| remove | When true, erases channel data. Otherwise, clears values. |
|
overrideprivatevirtual |
|
overrideprivatevirtual |
| std::optional< Session_legacy_stats > mysql::csa::Csa_service::get_session_legacy_stats | ( | const char * | channel, |
| std::size_t | worker_id | ||
| ) |
Obtains session legacy statistics kept in the RLI object.
| channel | Channel id |
| worker_id | Id of the worker for which we want to extract the session |
|
private |
Obtains session legacy statistics kept in the RLI object, no lock.
| channel | Channel id |
| worker_id | Id of the worker for which we want to extract the session |
| std::size_t mysql::csa::Csa_service::get_workers_number | ( | const char * | channel | ) |
Obtains the number of workers configured for the channel.
| std::optional< bool > mysql::csa::Csa_service::has_applied_all_work | ( | const char * | channel | ) |
Checks whether applier for the channel has applied all of the work and is waiting for more tasks.
| channel | Applier channel name |
| bool mysql::csa::Csa_service::initialize_channel_data | ( | const char * | channel, |
| std::size_t | channel_unique_id, | ||
| std::size_t | worker_num | ||
| ) |
This function is used only to initialize channel legacy statistics and to make empty statistics available in case channel was not activated.
| channel | Channel name |
| channel_unique_id | Channel unique integer identifier |
| worker_num | Workers number currently configured for this channel |
| bool mysql::csa::Csa_service::is_csa_event_applier | ( | const char * | channel, |
| unsigned int | thread_id | ||
| ) |
Checks whether CSA contains session with a given THD thread_id.
| channel | Selected channel |
| thread_id | THD thread identifier |
| void mysql::csa::Csa_service::remove | ( | Relay_log_info * | rli | ) |
Synchronous method that removes data and destroys objects related to the channel.
| rli | Channel RLI object |
| bool mysql::csa::Csa_service::run | ( | Relay_log_info * | rli | ) |
Synchronous method that runs the channel applier.
| rli | Channel RLI object |
| void mysql::csa::Csa_service::stop | ( | const char * | channel, |
| bool | force_kill | ||
| ) |
Stops applier now.
| channel | Channel name |
| force_kill | When true, awakes all sessions |
No more retries for transactions, applier is stopping
|
private |
Channel data.
|
private |
Cached statistics for inactive channels.
|
private |
The number of references (channels), protected with internal lock.
|
private |
When true, channels will execute soft stop after stop of the channel was requested.