24#ifndef MYSQL_CSA_JOB_APPLIER_H
25#define MYSQL_CSA_JOB_APPLIER_H
46 std::shared_ptr<Fetchable_transaction> fetch_object,
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Represents a channel in the Change Stream Applier (CSA).
Definition: channel.h:33
Concrete class representing job applied by the applier.
Definition: job_applier.h:36
void sync_rows_query_event_retention()
Keeps ROWS_QUERY event memory alive until Relay_log_info cleanup clears the query pointers that refer...
Definition: job_applier.cpp:497
bool can_be_retried() override
Check if transaction can be retried.
Definition: job_applier.cpp:472
Resource_instance_monitor_ref Resource_monitor_ref
Definition: job_applier.h:38
bool m_skip_rollback
Internal flag to skip transaction rollback, used by the restart.
Definition: job_applier.h:142
bool commit_register(Thread_id thread_id) override
Transaction "register for commit" phase, noop for control events.
Definition: job_applier.cpp:226
bool prepare(Thread_id thread_id) override
Transaction prepare phase, control events execute fully in prepare phase.
Definition: job_applier.cpp:277
void ensure_session(uint thread_id)
Acquires session if not already obtained.
Definition: job_applier.cpp:71
virtual ~Job_applier() override
Destructor.
Definition: job_applier.cpp:46
void finish_telemetry()
Internal function that finishes the transaction telemetry tracking.
Definition: job_applier.cpp:488
bool commit(Thread_id thread_id) override
Transaction commit phase, noop for control events.
Definition: job_applier.cpp:191
void finish_before_commit()
Called to clean up when a transaction is skipped (skipping commit phase):
Definition: job_applier.cpp:298
void set_failure() override
Sets job failure.
Definition: job_applier.cpp:510
mysql::csa::Relay_context_ptr m_relay_context
Relay context used to apply transaction.
Definition: job_applier.h:124
Job_applier(Channel *channel, unsigned int max_retries, std::shared_ptr< Fetchable_transaction > fetch_object, Stat_monitor_ref stat_monitor, Resource_monitor_ref res_monitor)
Constructor.
Definition: job_applier.cpp:39
Log_event_ptr m_rows_query_event
The currently active ROWS_QUERY event for statement-level processlist visibility.
Definition: job_applier.h:134
bool run_phase(Thread_id thread_id)
Apply events from phase until phase ends or transaction ends.
Definition: job_applier.cpp:308
void prepare_for_apply(Session_service_ptr ss)
Prepares this job to be applied.
Definition: job_applier.cpp:67
bool wait_for_rollback_and_restart()
Internal function to wait for rollback and restart transaction in case deadlock has been found.
Definition: job_applier.cpp:431
bool m_skip
Internal flag for skipping transaction used to check if we need to wait for unregistering from COM qu...
Definition: job_applier.h:139
bool check_rpco_conflict(Thread_id thread_id)
Checks and handles RPCO conflict if designated.
Definition: job_applier.cpp:283
bool m_co_registered
Flag indicating that trx registered in the COM queue.
Definition: job_applier.h:144
bool attach(Thread_id thread_id) override
Attaches to relay context.
Definition: job_applier.cpp:99
Log_event_ptr m_commit_event
Commit event, saved here for the commit phase in case of retry.
Definition: job_applier.h:131
bool apply_event(const Log_event_ptr &ev, THD *thd)
Applies a single event (internal helper)
Definition: job_applier.cpp:258
bool detach(Thread_id thread_id) override
Detaches from relay context.
Definition: job_applier.cpp:169
bool m_is_attached
Attach flag. Set to true when job is attached to the relay context.
Definition: job_applier.h:129
void start_telemetry()
Internal function that starts the transaction telemetry tracking.
Definition: job_applier.cpp:479
std::string to_string() override
Presents job identifier.
Definition: job_applier.cpp:466
bool is_attached() const override
Checks whether this job is attached to relay log context.
Definition: job_applier.cpp:464
Managed_event::Log_event_ptr Log_event_ptr
Type alias for log event pointer.
Definition: job_applier.h:80
Resource_monitor_ref m_resource_monitor
Resource monitoring object for the current channel instance.
Definition: job_applier.h:136
Session_service_ptr m_session_service
The session service to secure a THD and RLI objects when applying the job.
Definition: job_applier.h:127
bool restart() override
Restarts internal state.
Definition: job_applier.cpp:450
The Job_binlog class is a container that holds a buffer of fetchable events and context for the trans...
Definition: job_binlog.h:56
scheduler::Statistics_instance_monitor_ref Stat_monitor_ref
Alias to Statistics_instance_monitor_ref contained in the scheduler library.
Definition: job_binlog.h:60
unsigned int Thread_id
Type alias for thread identifier.
Definition: job.h:54
std::shared_ptr< Log_event > Log_event_ptr
Definition: managed_event.h:37
static my_thread_id thread_id
Definition: my_thr_init.cc:60
Definition: channel.cpp:28
std::shared_ptr< Session_service > Session_service_ptr
Shared pointer to Session_service.
Definition: session_service.h:40
std::reference_wrapper< Resource_instance_monitor > Resource_instance_monitor_ref
Definition: resource_monitor.h:43
std::shared_ptr< Relay_context > Relay_context_ptr
Definition: relay_context.h:39