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

Handles and operates the handled session. More...

#include <relay_context.h>

Public Types

using Parallel_worker_context = cs::apply::Parallel_worker_context
 
using Parallel_worker_context_ptr = cs::apply::Parallel_worker_context_ptr
 
using Csa_worker_context = cs::apply::Csa_worker_context
 
using Trx_id = Parallel_worker_context::Trx_id
 
using Worker_id = Parallel_worker_context::Worker_id
 

Public Member Functions

 Relay_context (std::size_t id, Relay_log_info *channel_config_rli)
 Constructor. More...
 
virtual ~Relay_context ()
 Destructor. More...
 
Relay_log_infoget_relay_log_info ()
 Obtains associated RLI pointer. More...
 
unsigned int get_thd_id () const
 Obtains THD identifier. More...
 
bool is_valid ()
 Checks validity. More...
 
void attach_session ()
 Attaches to session. Must succeed. More...
 
void detach_session ()
 Detaches from session. More...
 
Sessionget_session ()
 Obtains session handle. More...
 
std::size_t get_id () const
 Obtains this relay context id. More...
 
void set_fde (Format_description_log_event *fde)
 Sets FDE for this relay context. More...
 
void set_parallel_worker_context (Commit_order_manager *com, Trx_id trx_seq_num, Worker_id worker_id, const std::string &channel_id, int current_retry, int retries_num)
 Sets parallel worker context for the next transaction. More...
 
void register_to_commit_order ()
 if attached to commit order manager, registers parallel worker to commit order (using parallel worker context) More...
 
void report_error (const std::string &trx_id)
 Report error to parent thread. More...
 
void enable_stop_error_suppression_if_clean ()
 Enables stop error suppression if this context had no reported error. More...
 
cs::apply::Csa_worker_contextget_parallel_worker_context ()
 Obtain parallel worker context. More...
 
void clean ()
 Clean-up session. More...
 
void awake (bool force_kill)
 Awakes sessions to faster end execution. More...
 
void attach_rli ()
 Attaches to RLI. More...
 
void detach_rli ()
 Detaches from RLI. More...
 
void retry_transaction (int current_count, bool skip_rollback)
 Prepares context for retry. More...
 
bool wait_for_rollback ()
 Waits for external parallel context rollback. More...
 
bool can_be_retried ()
 Check if handled context can be retried. More...
 

Private Attributes

std::unique_ptr< Relay_log_infom_rli
 A pointer to the relay context. More...
 
Session m_session
 Session. More...
 
bool m_attached {false}
 Flag indicating whether this session is currently attached to CSA worker. More...
 
Commit_order_managerm_commit_order_manager {nullptr}
 Commit order manager. More...
 
Relay_log_infom_channel_config_rli {nullptr}
 Parent channel configuration RLI. More...
 
std::size_t m_id {0}
 This relay context identifier. More...
 
std::unique_ptr< Csa_worker_contextm_csa_worker_context
 Pointer to CSA worker context. More...
 

Detailed Description

Handles and operates the handled session.

See also
Session

Member Typedef Documentation

◆ Csa_worker_context

◆ Parallel_worker_context

◆ Parallel_worker_context_ptr

◆ Trx_id

◆ Worker_id

Constructor & Destructor Documentation

◆ Relay_context()

mysql::csa::Relay_context::Relay_context ( std::size_t  id,
Relay_log_info channel_config_rli 
)

Constructor.

Parameters
idThis relay context id
channel_config_rliChannel configuration RLI

◆ ~Relay_context()

mysql::csa::Relay_context::~Relay_context ( )
virtual

Destructor.

Member Function Documentation

◆ attach_rli()

void mysql::csa::Relay_context::attach_rli ( )

Attaches to RLI.

◆ attach_session()

void mysql::csa::Relay_context::attach_session ( )

Attaches to session. Must succeed.

◆ awake()

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

Awakes sessions to faster end execution.

Parameters
force_killWhen true, kills THDs

◆ can_be_retried()

bool mysql::csa::Relay_context::can_be_retried ( )

Check if handled context can be retried.

Returns
True if transaction can be retried, false otherwise

◆ clean()

void mysql::csa::Relay_context::clean ( )

Clean-up session.

◆ detach_rli()

void mysql::csa::Relay_context::detach_rli ( )

Detaches from RLI.

◆ detach_session()

void mysql::csa::Relay_context::detach_session ( )

Detaches from session.

◆ enable_stop_error_suppression_if_clean()

void mysql::csa::Relay_context::enable_stop_error_suppression_if_clean ( )

Enables stop error suppression if this context had no reported error.

◆ get_id()

std::size_t mysql::csa::Relay_context::get_id ( ) const

Obtains this relay context id.

◆ get_parallel_worker_context()

cs::apply::Csa_worker_context * mysql::csa::Relay_context::get_parallel_worker_context ( )

Obtain parallel worker context.

Returns
pointer to object containing worker context

◆ get_relay_log_info()

Relay_log_info * mysql::csa::Relay_context::get_relay_log_info ( )

Obtains associated RLI pointer.

Returns
RLI pointer from handled session

◆ get_session()

Session & mysql::csa::Relay_context::get_session ( )
inline

Obtains session handle.

Returns
Session reference

◆ get_thd_id()

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

Obtains THD identifier.

Returns
Handled THD identifier

◆ is_valid()

bool mysql::csa::Relay_context::is_valid ( void  )

Checks validity.

Returns
True if valid, false otherwise.

◆ register_to_commit_order()

void mysql::csa::Relay_context::register_to_commit_order ( )

if attached to commit order manager, registers parallel worker to commit order (using parallel worker context)

◆ report_error()

void mysql::csa::Relay_context::report_error ( const std::string &  trx_id)

Report error to parent thread.

Parameters
trx_idApplier transaction identifier

◆ retry_transaction()

void mysql::csa::Relay_context::retry_transaction ( int  current_count,
bool  skip_rollback 
)

Prepares context for retry.

Parameters
current_countCurrent retries number for this transaction
skip_rollbackTrue if we need to skip rollback (already rolled back)

◆ set_fde()

void mysql::csa::Relay_context::set_fde ( Format_description_log_event fde)

Sets FDE for this relay context.

Parameters
fdeFDE that will be used to apply transactions

◆ set_parallel_worker_context()

void mysql::csa::Relay_context::set_parallel_worker_context ( Commit_order_manager com,
Relay_context::Trx_id  trx_seq_num,
Relay_context::Worker_id  worker_id,
const std::string &  channel_id,
int  current_retry,
int  retries_num 
)

Sets parallel worker context for the next transaction.

Parameters
comCurrent commit order manager pointer
trx_seq_numTransaction sequence number
worker_idWorker identifier - sequence number
channel_idChannel identifier - string
current_retryCurrent number of retries
retries_numAllowed number of retries

◆ wait_for_rollback()

bool mysql::csa::Relay_context::wait_for_rollback ( )

Waits for external parallel context rollback.

Returns
True on failure, false on success

Member Data Documentation

◆ m_attached

bool mysql::csa::Relay_context::m_attached {false}
private

Flag indicating whether this session is currently attached to CSA worker.

◆ m_channel_config_rli

Relay_log_info* mysql::csa::Relay_context::m_channel_config_rli {nullptr}
private

Parent channel configuration RLI.

◆ m_commit_order_manager

Commit_order_manager* mysql::csa::Relay_context::m_commit_order_manager {nullptr}
private

Commit order manager.

◆ m_csa_worker_context

std::unique_ptr<Csa_worker_context> mysql::csa::Relay_context::m_csa_worker_context
private

Pointer to CSA worker context.

◆ m_id

std::size_t mysql::csa::Relay_context::m_id {0}
private

This relay context identifier.

◆ m_rli

std::unique_ptr<Relay_log_info> mysql::csa::Relay_context::m_rli
private

A pointer to the relay context.

It shall be a dummy context, as there is no need to store positions in tables or files, since this applier only supports GTIDs

◆ m_session

Session mysql::csa::Relay_context::m_session
private

Session.


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