24#ifndef MYSQL_CSA_SERVICE_H
25#define MYSQL_CSA_SERVICE_H
67 using Clock_ptr = std::shared_ptr<mysql::scheduler::Scheduler_clock>;
105 const char *
channel, std::size_t worker_id);
125 std::size_t channel_unique_id,
126 std::size_t worker_num);
146 const char *
channel, std::size_t worker_id);
164 std::unordered_map<std::string, std::vector<Session_legacy_stats>>
Definition: rpl_rli.h:208
Service class for the Change Streams Applier (CSA)
Definition: csa_service.h:54
std::shared_ptr< Thread_pool > Thread_pool_ptr
Shared pointer to Thread_pool.
Definition: csa_service.h:63
mysql::scheduler::Dependency_tracker_ptr Dependency_tracker_ptr
Shared pointer to Dependency_tracker.
Definition: csa_service.h:79
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.
Definition: csa_service.cpp:549
void stop(const char *channel, bool force_kill)
Stops applier now.
Definition: csa_service.cpp:437
bool is_csa_event_applier(const char *channel, unsigned int thread_id)
Checks whether CSA contains session with a given THD thread_id.
Definition: csa_service.cpp:587
mysql::csa::Session_service_ptr Session_service_ptr
Shared pointer to Session_service.
Definition: csa_service.h:81
void remove(Relay_log_info *rli)
Synchronous method that removes data and destroys objects related to the channel.
Definition: csa_service.cpp:370
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 avail...
Definition: csa_service.cpp:486
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.
Definition: csa_service.cpp:505
std::unordered_map< std::string, Csa_channel > csa_channels
Channel data.
Definition: csa_service.h:162
std::size_t get_workers_number(const char *channel)
Obtains the number of workers configured for the channel.
Definition: csa_service.cpp:470
virtual ~Csa_service() override
Destructor.
Definition: csa_service.cpp:55
bool do_deinit() override
Deinitialization.
Definition: csa_service.cpp:62
std::shared_ptr< mysql::scheduler::Scheduler_clock > Clock_ptr
Shared pointer to Scheduler_clock.
Definition: csa_service.h:67
mysql::scheduler::Task_result Task_result
Result type for tasks.
Definition: csa_service.h:57
std::atomic< bool > m_soft_stop
When true, channels will execute soft stop after stop of the channel was requested.
Definition: csa_service.h:168
std::shared_ptr< Schedule_factory > Schedule_factory_ptr
Shared pointer to Schedule_factory.
Definition: csa_service.h:75
std::shared_ptr< Scheduler_type > Scheduler_ptr
Shared pointer to Scheduler_type.
Definition: csa_service.h:71
bool run(Relay_log_info *rli)
Synchronous method that runs the channel applier.
Definition: csa_service.cpp:115
std::unordered_map< std::string, std::vector< Session_legacy_stats > > m_inactive_channel_stats
Cached statistics for inactive channels.
Definition: csa_service.h:165
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.
Definition: csa_service.cpp:575
bool do_init() override
Initialization.
Definition: csa_service.cpp:57
void clean_up_context(const std::string &channel)
Helper function to clean up channel data upon destruction.
Definition: csa_service.cpp:385
void clear_channel_data(const char *channel, bool remove)
This function is used only to remove cached channel statistics upon channel deletion.
Definition: csa_service.cpp:558
Csa_service()
Constructor.
Definition: csa_service.cpp:52
unsigned int m_kernel_ref_count
The number of references (channels), protected with internal lock.
Definition: csa_service.h:160
Represents a lockable module.
Definition: module.h:40
Clock implementation that computes LWM (Low Water Mark) based on executed tasks.
Definition: clock_lwm_registry.h:85
Definition: commit_order_clock.h:38
Dependency tracker stub: empty tracker, does not check dependencies.
Definition: dependency_tracker_stub.h:33
Schedule factory class - creates task schedule object pointer based on input parameters.
Definition: schedule_factory.h:38
Main scheduling class.
Definition: scheduler.h:66
Supported statistics:
Definition: statistics_map.h:43
MySQL wrapper for a condition variable, template which may be specialized with a specific implementat...
Definition: thread_pool.h:48
mysql::csa::Statistics_map Statistics_map
Definition: job_applier.cpp:33
static my_thread_id thread_id
Definition: my_thr_init.cc:60
constexpr std::size_t scheduler_tp_queue_size
Definition: tune.h:37
Definition: channel.cpp:28
std::shared_ptr< Session_service > Session_service_ptr
Shared pointer to Session_service.
Definition: session_service.h:40
std::unique_ptr< Base_dependency_tracker > Dependency_tracker_ptr
Definition: base_dependency_tracker.h:89
Task_result
Acceptable task state after its execution.
Definition: task_result.h:32