MySQL 26.7.0
Source Code Documentation
csa_channel.h
Go to the documentation of this file.
1// Copyright (c) 2026, Oracle and/or its affiliates.
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License, version 2.0,
5// as published by the Free Software Foundation.
6//
7// This program is designed to work with certain software (including
8// but not limited to OpenSSL) that is licensed under separate terms,
9// as designated in a particular file or component or in included license
10// documentation. The authors of MySQL hereby grant you an additional
11// permission to link the program and your derivative works with the
12// separately licensed software that they have either included with
13// the program or referenced in the documentation.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without 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 MYSQL_CSA_SERVICE_CSA_CHANNEL_H
25#define MYSQL_CSA_SERVICE_CSA_CHANNEL_H
26
27#include <memory>
28#include <ostream>
36
37namespace mysql::csa {
38
39/// Aggregates applier structures for a single channel
41 /// @brief Thread pool type for the scheduler
43 /// @brief Shared pointer to Thread_pool
44 using Thread_pool_ptr = std::shared_ptr<Thread_pool>;
45 /// @brief Shared pointer to Scheduler_clock
46 using Clock_ptr = std::shared_ptr<scheduler::Scheduler_clock>;
47 /// @brief Scheduler type
49 /// @brief Shared pointer to Scheduler_type
50 using Scheduler_ptr = std::shared_ptr<Scheduler_type>;
51 /// @brief Schedule factory type
53 /// @brief Shared pointer to Schedule_factory
54 using Schedule_factory_ptr = std::shared_ptr<Schedule_factory>;
55 /// @brief Shared pointer to Session_service
56 using Session_service_ptr = std::shared_ptr<Session_service>;
57
58 /// @brief Thread pool instance
60 /// @brief Channel clock
62 /// @brief Channel commit order clock
64 /// @brief Session service - sessions contain channel information
66 /// @brief Scheduler
68 /// @brief Transaction provider for this channel
70 /// Channel unique instance id
72 /// Channel THD
74 /// Stop channel flag, to avoid retries after applier stop
75 std::atomic<bool> m_channel_stopped{false};
76 /// Stop stop flag, when enabled, CSA won't kill ongoing sessions
77 std::atomic<bool> m_soft_stop_enabled{false};
78};
79
80} // namespace mysql::csa
81
82#endif // MYSQL_CSA_SERVICE_CSA_CHANNEL_H
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Schedule factory class - creates task schedule object pointer based on input parameters.
Definition: schedule_factory.h:38
Main scheduling class.
Definition: scheduler.h:66
MySQL wrapper for a condition variable, template which may be specialized with a specific implementat...
Definition: thread_pool.h:48
Definition: channel.cpp:28
std::shared_ptr< Transaction_provider > Transaction_provider_sptr
Definition: transaction_provider.h:34
Aggregates applier structures for a single channel.
Definition: csa_channel.h:40
std::atomic< bool > m_channel_stopped
Stop channel flag, to avoid retries after applier stop.
Definition: csa_channel.h:75
THD * channel_thd
Channel THD.
Definition: csa_channel.h:73
Thread_pool_ptr thread_pool
Thread pool instance.
Definition: csa_channel.h:59
std::size_t channel_instance_id
Channel unique instance id.
Definition: csa_channel.h:71
std::shared_ptr< Thread_pool > Thread_pool_ptr
Shared pointer to Thread_pool.
Definition: csa_channel.h:44
Session_service_ptr session_service
Session service - sessions contain channel information.
Definition: csa_channel.h:65
Clock_ptr scheduler_clock
Channel clock.
Definition: csa_channel.h:61
std::shared_ptr< Scheduler_type > Scheduler_ptr
Shared pointer to Scheduler_type.
Definition: csa_channel.h:50
std::shared_ptr< scheduler::Scheduler_clock > Clock_ptr
Shared pointer to Scheduler_clock.
Definition: csa_channel.h:46
Transaction_provider_sptr provider
Transaction provider for this channel.
Definition: csa_channel.h:69
std::atomic< bool > m_soft_stop_enabled
Stop stop flag, when enabled, CSA won't kill ongoing sessions.
Definition: csa_channel.h:77
std::shared_ptr< Session_service > Session_service_ptr
Shared pointer to Session_service.
Definition: csa_channel.h:56
std::shared_ptr< Schedule_factory > Schedule_factory_ptr
Shared pointer to Schedule_factory.
Definition: csa_channel.h:54
Clock_ptr commit_order_clock
Channel commit order clock.
Definition: csa_channel.h:63
Scheduler_ptr scheduler
Scheduler.
Definition: csa_channel.h:67