MySQL 26.7.0
Source Code Documentation
mysql::csa::Session_service Class Referenceabstract

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

#include <session_service.h>

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

Public Types

using Task_id = mysql::scheduler::Task_id
 Alias for task identifier. More...
 

Public Member Functions

virtual ~Session_service ()=default
 Virtual destructor. More...
 
virtual bool init (std::size_t session_number, Relay_log_info *channel_rli)=0
 Initializes the session service. More...
 
virtual bool deinit ()=0
 Deinitializes the session service. 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...
 
virtual Relay_context_ptr acquire_session (Task_id id)=0
 Acquires session. More...
 
virtual void release_session (Relay_context_ptr session, Task_id id)=0
 Releases a session back to the pool. 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...
 

Protected Attributes

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.

Base class for maintaining session pool available for CSA workers

Member Typedef Documentation

◆ Task_id

Constructor & Destructor Documentation

◆ ~Session_service()

virtual mysql::csa::Session_service::~Session_service ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ acquire_session()

virtual Relay_context_ptr mysql::csa::Session_service::acquire_session ( Task_id  id)
pure virtual

Acquires session.

Parameters
idAttach id for the session (internal sequence session id)
Returns
Acquired session shared pointer

Implemented in mysql::csa::Session_service_bounded_queue.

◆ awake_sessions()

void mysql::csa::Session_service::awake_sessions ( bool  force_kill)

Awakes sessions to faster end execution.

Parameters
force_killWhen true, kills THDs

◆ clean_sessions()

void mysql::csa::Session_service::clean_sessions ( )

Performs clean up of sessions, including rollback.

◆ deinit()

virtual bool mysql::csa::Session_service::deinit ( )
pure virtual

Deinitializes the session service.

Returns
False if deinitialization succeeds, true otherwise

Implemented in mysql::csa::Session_service_bounded_queue.

◆ enable_stop_error_suppression_for_clean_sessions()

void mysql::csa::Session_service::enable_stop_error_suppression_for_clean_sessions ( )

Enables stop error suppression for sessions that have no reported error.

◆ get_session_number()

std::size_t mysql::csa::Session_service::get_session_number ( )
virtual

Obtains the number of all sessions.

Returns
Number of session in this session pool

◆ get_session_stats()

std::optional< Session_legacy_stats > mysql::csa::Session_service::get_session_stats ( std::size_t  session_id)

Obtains session statistics.

Returns
Upon success, returns corresponding legacy stats. If they are unavailable due to e.g. non-existing session id, returns an empty object

◆ has_thd_id()

bool mysql::csa::Session_service::has_thd_id ( unsigned int  thd_id) const

Checks whether session service contains a given THD thread id.

Parameters
thd_idTHD thread identifier to check
Returns
When true, session service contains THD with a given thd_id. False otherwise.

◆ init()

virtual bool mysql::csa::Session_service::init ( std::size_t  session_number,
Relay_log_info channel_rli 
)
pure virtual

Initializes the session service.

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

Implemented in mysql::csa::Session_service_bounded_queue.

◆ release_session()

virtual void mysql::csa::Session_service::release_session ( Relay_context_ptr  session,
Task_id  id 
)
pure virtual

Releases a session back to the pool.

Parameters
sessionSession to return to the session pool
idSession internal ID

Implemented in mysql::csa::Session_service_bounded_queue.

Member Data Documentation

◆ m_all_sessions

std::unordered_map<std::size_t, Relay_context_ptr> mysql::csa::Session_service::m_all_sessions
protected

Aggregates all sessions in order to look at specific session data.

◆ m_thd_ids

std::unordered_set<unsigned int> mysql::csa::Session_service::m_thd_ids
protected

Captured THD identifiers for easy access.


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