24#ifndef MYSQL_CS_APPLY_CSA_WORKER_CONTEXT_H
25#define MYSQL_CS_APPLY_CSA_WORKER_CONTEXT_H
49 const std::string &channel_id,
THD *trx_ctx,
50 int current_retry,
int retries_num);
108 const std::string &channel_id,
THD *trx_ctx,
int current_retry,
133 bool is_csa()
const override;
Context of the owner of metadata locks.
Definition: mdl.h:1415
Definition: rpl_rli.h:208
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Class representing the interface for parallel worker context.
Definition: csa_worker_context.h:46
bool can_be_retried(THD *thd) override
Returns information on whether THD transaction can be retried.
Definition: csa_worker_context.cc:146
Rpco_state
RPCO lifecycle visible to deadlock reporting:
Definition: csa_worker_context.h:140
MDL_context * get_mdl_context() override
MDL context accessor.
Definition: csa_worker_context.cc:119
bool wait_for_rollback()
Waits for external rollback to finish.
Definition: csa_worker_context.cc:64
Trx_id get_trx_id() override
Obtain transaction id (sequence number)
Definition: csa_worker_context.cc:169
Trx_id m_trx_id
Transaction identifier reused by commit-order logic.
Definition: csa_worker_context.h:151
std::string m_for_channel_id
Cached "for channel" suffix, built lazily for diagnostics.
Definition: csa_worker_context.h:163
Worker_id m_worker_id
Current worker slot owning this transaction context.
Definition: csa_worker_context.h:153
std::atomic< bool > m_rollback
Set once an external rollback request has been enqueued.
Definition: csa_worker_context.h:145
bool is_same_channel(const Parallel_worker_context *arg) const override
Checks if arg parallel worker executes transaction coming from the same channel.
Definition: csa_worker_context.cc:98
int m_current_retry
Retry number of the current attempt.
Definition: csa_worker_context.h:159
void reset_commit_order_deadlock() override
Resets commit order deadlock.
Definition: csa_worker_context.cc:91
Csa_worker_context(Trx_id trx_seq_num, Worker_id worker_id, const std::string &channel_id, THD *trx_ctx, int current_retry, int retries_num)
Definition: csa_worker_context.cc:33
THD * get_transaction_ctx() override
Returns transaction id (we use sequence number)
Definition: csa_worker_context.cc:113
const std::string & get_channel_id() const
Channel identifier accessor.
Definition: csa_worker_context.cc:109
void set_applied()
Mark transaction as prepared and externally rollbackable.
Definition: csa_worker_context.cc:82
Parallel_worker_context::Trx_id Trx_id
Definition: csa_worker_context.h:52
Parallel_worker_context::Worker_id Worker_id
Definition: csa_worker_context.h:53
std::atomic< bool > m_is_commit_order_deadlock
Sticky indicator that this transaction was reported as an RPCO victim.
Definition: csa_worker_context.h:143
bool has_temporary_error(THD *thd, int error)
Checks whether this transaction error is temporary.
Definition: csa_worker_context.cc:124
void update(Trx_id trx_seq_num, Worker_id worker_id, THD *trx_ctx, int current_retry)
Updates internal data for a new transaction.
Definition: csa_worker_context.cc:195
void report_commit_order_deadlock(bool for_self=false) override
Indicates that commit order deadlock has been found.
Definition: csa_worker_context.cc:44
Worker_id get_worker_id() const override
Returns worker id.
Definition: csa_worker_context.cc:115
std::promise< bool > m_rollback_promise
Completes when the external rollback worker finishes rescue handling.
Definition: csa_worker_context.h:149
std::atomic< Rpco_state > m_rpco_state
Current RPCO lifecycle state used to decide how to handle reports.
Definition: csa_worker_context.h:147
bool found_commit_order_deadlock() const override
Checks if commit order deadlock has been found.
Definition: csa_worker_context.cc:60
int m_retries_num
Maximum number of retries allowed for this transaction.
Definition: csa_worker_context.h:161
const char * get_for_channel_id(bool upper_case) const override
Get "for channel" id.
Definition: csa_worker_context.cc:179
bool is_rollback_requested() const
Check if external rollback is on-going.
Definition: csa_worker_context.h:123
std::string m_channel_id
Replication channel this transaction belongs to.
Definition: csa_worker_context.h:155
void set_committing()
Move transaction from prepared into committing state.
Definition: csa_worker_context.cc:86
bool is_csa() const override
Checks whether this worker is CSA worker.
Definition: csa_worker_context.cc:215
static instruments::Dummy_worker_metrics m_disabled_worker_metrics
Worker metrics.
Definition: csa_worker_context.h:130
void handle_commit_order_deadlock()
Handle commit order deadlock - one of the callers will request transaction rollback due to rpco deadl...
Definition: csa_worker_context.cc:70
instruments::Worker_metrics & get_worker_metrics() override
Obtains worker metrics.
Definition: csa_worker_context.cc:171
THD * m_trx_ctx
THD currently bound to this transaction context.
Definition: csa_worker_context.h:157
Class representing the interface for parallel worker context.
Definition: parallel_worker_context.h:47
int64_t Trx_id
Definition: parallel_worker_context.h:51
uint64_t Worker_id
Definition: parallel_worker_context.h:52
Class that intends to be a dummy end point for worker metrics.
Definition: dummy_worker_metrics.h:34
Abstract class for classes that contain metrics related to transaction execution in applier workers.
Definition: worker_metrics.h:34
Definition: applier_version.h:27