MySQL 26.7.0
Source Code Documentation
mysql::csa::Session_service_bounded_queue Class Reference

Service that provides a free session to executing transactions. More...

#include <session_service_bounded_queue.h>

Inheritance diagram for mysql::csa::Session_service_bounded_queue:
[legend]

Public Types

using Task_id = Session_service::Task_id
 Alias for task identifier from base class. More...
 
- Public Types inherited from mysql::csa::Session_service
using Task_id = mysql::scheduler::Task_id
 Alias for task identifier. More...
 

Public Member Functions

 Session_service_bounded_queue (Session_service_psi psi_params={})
 Constructor. More...
 
virtual ~Session_service_bounded_queue () override
 Virtual destructor. More...
 
bool init (std::size_t session_number, Relay_log_info *channel_rli) override
 Initializes the session service with a bounded queue. More...
 
bool deinit () override
 Deinitializes the session service. More...
 
Relay_context_ptr acquire_session (Task_id id) override
 Acquires a session for the given task ID. More...
 
void release_session (Relay_context_ptr session, Task_id id) override
 Releases a session back to the pool. More...
 
- Public Member Functions inherited from mysql::csa::Session_service
virtual ~Session_service ()=default
 Virtual destructor. More...
 
std::optional< Session_legacy_statsget_session_stats (std::size_t session_id)
 Obtains session statistics. More...
 
virtual std::size_t get_session_number ()
 Obtains the number of all sessions. More...
 
void clean_sessions ()
 Performs clean up of sessions, including rollback. More...
 
void enable_stop_error_suppression_for_clean_sessions ()
 Enables stop error suppression for sessions that have no reported error. More...
 
bool has_thd_id (unsigned int thd_id) const
 Checks whether session service contains a given THD thread id. More...
 
void awake_sessions (bool force_kill)
 Awakes sessions to faster end execution. More...
 

Private Types

using Relay_context_entry = std::shared_ptr< Relay_context >
 Type alias for a shared pointer to Relay_context. More...
 
using Session_registry = mysql::concurrency::Sync_bounded_queue< Relay_context_ptr, tune::csa_session_default_cache_size >
 Type alias for the synchronized bounded queue of Relay_context_ptr. More...
 

Private Attributes

Session_registry m_sessions
 The session registry queue. More...
 
std::size_t m_session_number {tune::csa_session_default_cache_size}
 The number of maintained sessions. More...
 
Relay_log_infom_channel_rli {nullptr}
 Pointer to the channel RLI (to share data, such as applier privileges) More...
 
Session_service_psi m_psi
 PSI parameters. More...
 

Additional Inherited Members

- Protected Attributes inherited from mysql::csa::Session_service
std::unordered_map< std::size_t, Relay_context_ptrm_all_sessions
 Aggregates all sessions in order to look at specific session data. More...
 
std::unordered_set< unsigned int > m_thd_ids
 Captured THD identifiers for easy access. More...
 

Detailed Description

Service that provides a free session to executing transactions.

Member Typedef Documentation

◆ Relay_context_entry

Type alias for a shared pointer to Relay_context.

◆ Session_registry

◆ Task_id

Alias for task identifier from base class.

Constructor & Destructor Documentation

◆ Session_service_bounded_queue()

mysql::csa::Session_service_bounded_queue::Session_service_bounded_queue ( Session_service_psi  psi_params = {})

Constructor.

Parameters
psi_paramsInstrumentation parameters

◆ ~Session_service_bounded_queue()

mysql::csa::Session_service_bounded_queue::~Session_service_bounded_queue ( )
overridevirtual

Virtual destructor.

Member Function Documentation

◆ acquire_session()

Relay_context_ptr mysql::csa::Session_service_bounded_queue::acquire_session ( Task_id  id)
overridevirtual

Acquires a session for the given task ID.

Parameters
idThe task ID
Returns
A shared pointer to the Relay_context

Implements mysql::csa::Session_service.

◆ deinit()

bool mysql::csa::Session_service_bounded_queue::deinit ( )
overridevirtual

Deinitializes the session service.

Returns
False on success, true on failure

Implements mysql::csa::Session_service.

◆ init()

bool mysql::csa::Session_service_bounded_queue::init ( std::size_t  session_number,
Relay_log_info channel_rli 
)
overridevirtual

Initializes the session service with a bounded queue.

Parameters
session_numberThe number of sessions to add to initial pool
channel_rliParent RLI - channel RLI to share common applier config
Returns
True if initialization succeeds, false otherwise

Implements mysql::csa::Session_service.

◆ release_session()

void mysql::csa::Session_service_bounded_queue::release_session ( Relay_context_ptr  session,
Session_service::Task_id  id 
)
overridevirtual

Releases a session back to the pool.

Parameters
sessionSession to return to the session pool
idSession internal ID

Implements mysql::csa::Session_service.

Member Data Documentation

◆ m_channel_rli

Relay_log_info* mysql::csa::Session_service_bounded_queue::m_channel_rli {nullptr}
private

Pointer to the channel RLI (to share data, such as applier privileges)

◆ m_psi

Session_service_psi mysql::csa::Session_service_bounded_queue::m_psi
private

PSI parameters.

◆ m_session_number

std::size_t mysql::csa::Session_service_bounded_queue::m_session_number {tune::csa_session_default_cache_size}
private

The number of maintained sessions.

◆ m_sessions

Session_registry mysql::csa::Session_service_bounded_queue::m_sessions
private

The session registry queue.


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