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

Wraps up THD object and provides simple function to manage its execution within CSA. More...

#include <session.h>

Public Member Functions

 Session (THD *parent_thd, std::size_t seq_num)
 Construct from configuration in parent_thd. More...
 
virtual ~Session ()
 Destructor. More...
 
bool is_valid () const
 Checks if created session is valid True when session is valid, false otherwise. More...
 
unsigned int get_thd_id () const
 Obtains handled THD identifier. More...
 
THDget_thd ()
 Obtains THD handle. More...
 
ulonglong get_thread_id () const
 Obtains thread identifier. More...
 
void awake (bool force_kill)
 Awakes the handled session. More...
 
void attach (TABLE *temporary_tables)
 Attach current thread to session. More...
 
void detach ()
 Detach current thread from session. More...
 
bool self_killed () const
 Check if CSA killed this session. More...
 
bool is_killed () const
 

Protected Attributes

THDm_thd
 The base server session associated with this processor. More...
 
ulonglong m_psi_id {0}
 PSI thread id. More...
 
const char * m_saved_thread_stack {""}
 Saved THD stack. More...
 
long m_stack_ptr {0}
 Saved stack pointer. More...
 
bool m_is_valid {false}
 Validity flag. More...
 
bool m_is_attached {false}
 Attach flag. More...
 
bool m_is_killed {false}
 We save our own kill flag and protect modifications with LOCK_thd_data. More...
 
concurrency::Spin_lock_mutex m_session_lock
 Session lock for protecting attach/detach operations. More...
 

Detailed Description

Wraps up THD object and provides simple function to manage its execution within CSA.

Constructor & Destructor Documentation

◆ Session()

mysql::csa::Session::Session ( THD parent_thd,
std::size_t  seq_num 
)

Construct from configuration in parent_thd.

Parameters
parent_thdConfiguration THD
seq_numSession sequence number

◆ ~Session()

mysql::csa::Session::~Session ( )
virtual

Destructor.

Member Function Documentation

◆ attach()

void mysql::csa::Session::attach ( TABLE temporary_tables)

Attach current thread to session.

Must succeed.

Parameters
temporary_tablesTemporary tables we attach

◆ awake()

void mysql::csa::Session::awake ( bool  force_kill)

Awakes the handled session.

Parameters
force_killIf true, kills session

◆ detach()

void mysql::csa::Session::detach ( )

Detach current thread from session.

◆ get_thd()

THD * mysql::csa::Session::get_thd ( )

Obtains THD handle.

◆ get_thd_id()

unsigned int mysql::csa::Session::get_thd_id ( ) const

Obtains handled THD identifier.

Returns
THD identifier

◆ get_thread_id()

ulonglong mysql::csa::Session::get_thread_id ( ) const

Obtains thread identifier.

◆ is_killed()

bool mysql::csa::Session::is_killed ( ) const
inline
Returns
True only if this session was killed; false otherwise

◆ is_valid()

bool mysql::csa::Session::is_valid ( void  ) const

Checks if created session is valid True when session is valid, false otherwise.

◆ self_killed()

bool mysql::csa::Session::self_killed ( ) const
inline

Check if CSA killed this session.

Returns
True only if this session was killed by CSA; false otherwise

Member Data Documentation

◆ m_is_attached

bool mysql::csa::Session::m_is_attached {false}
protected

Attach flag.

◆ m_is_killed

bool mysql::csa::Session::m_is_killed {false}
protected

We save our own kill flag and protect modifications with LOCK_thd_data.

◆ m_is_valid

bool mysql::csa::Session::m_is_valid {false}
protected

Validity flag.

◆ m_psi_id

ulonglong mysql::csa::Session::m_psi_id {0}
protected

PSI thread id.

◆ m_saved_thread_stack

const char* mysql::csa::Session::m_saved_thread_stack {""}
protected

Saved THD stack.

◆ m_session_lock

concurrency::Spin_lock_mutex mysql::csa::Session::m_session_lock
protected

Session lock for protecting attach/detach operations.

While LOCK_thd_data could be used, in a large session pool we avoid its potential syscalls by using a spinlock instead.

◆ m_stack_ptr

long mysql::csa::Session::m_stack_ptr {0}
protected

Saved stack pointer.

◆ m_thd

THD* mysql::csa::Session::m_thd
protected

The base server session associated with this processor.


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