24#ifndef MYSQL_CSA_JOB_BINLOG_H
25#define MYSQL_CSA_JOB_BINLOG_H
73 std::shared_ptr<Fetchable_transaction> fetch_object,
137 bool is_trx()
const override;
141 void skip()
override;
Represents a channel in the Change Stream Applier (CSA).
Definition: channel.h:33
The Job_binlog class is a container that holds a buffer of fetchable events and context for the trans...
Definition: job_binlog.h:56
Channel * m_channel
The channel this transaction is coming from.
Definition: job_binlog.h:151
virtual bool commit_register(Thread_id thread_id)=0
Register the transaction for commit phase.
const std::string & get_channel_id() const
Gets the transaction identifier as a string.
Definition: job_binlog.cpp:52
virtual bool prepare(Thread_id thread_id)=0
Run prepare phase of this transaction.
uint32_t m_next_event
The cursor for the events to process.
Definition: job_binlog.h:155
virtual ~Job_binlog() override
Destructor for Job_binlog.
Definition: job_binlog.cpp:46
const mysql::gtid::Gtid & get_trx_gtid() const
Gets the transaction GTID.
Definition: job_binlog.h:88
unsigned int get_instance_id() const override
Obtains unique instance id to gather statistics separately for different "instances".
Definition: job_binlog.cpp:66
virtual bool is_complete()
Checks if this transaction has finished fetching.
Definition: job_binlog.cpp:90
bool is_trx() const override
Checks whether handled job is a transaction (supports two phases)
Definition: job_binlog.cpp:138
mysql::gtid::Gtid m_trx_gtid
The GTID of the transaction. "<unknown>" if not available.
Definition: job_binlog.h:149
Channel * get_channel() const
Gets the channel this job comes from.
Definition: job_binlog.cpp:48
mysql::csa::Managed_event m_first_event
The first event fetched to obtain GTID information.
Definition: job_binlog.h:153
bool restart() override
Restarts the job and prepares for retry.
Definition: job_binlog.cpp:140
Stat_monitor_ref m_stat_monitor
Statistics monitoring object for the current instance.
Definition: job_binlog.h:157
Transaction_phase m_phase
Transaction phase indicator:
Definition: job_binlog.h:166
unsigned long long get_last_committed() const
Gets the last committed value to determine when this transaction can run.
Definition: job_binlog.cpp:56
Job_binlog(const Job_binlog &)=delete
Deleted copy constructor.
bool restart_internal(bool all)
Restarts job with fetch metadata.
Definition: job_binlog.cpp:142
std::shared_ptr< Fetchable_transaction > m_fetch_metadata
Information on how to fetch transaction data.
Definition: job_binlog.h:159
std::string get_trx_id() const
Get transaction GTID.
Definition: job_binlog.cpp:50
unsigned long long get_trx_length() const
Gets the transaction length.
Definition: job_binlog.cpp:170
bool run(Thread_id thread_id) override
Binlog job needs to be called twice to apply transaction:
Definition: job_binlog.cpp:104
void skip() override
Skip this job, considered complete and done without failure.
Definition: job_binlog.cpp:98
void set_done() override
Mark the transaction as done (done with failure or done successfully.
Definition: job_binlog.cpp:92
void set_success() override
success callback
Definition: job_binlog.cpp:70
virtual bool commit(Thread_id thread_id)=0
Run commit phase of this transaction.
Job_binlog & operator=(const Job_binlog &)=delete
Deleted assignment operator.
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 long long get_sequence_number() const
Gets the sequence number of this transaction to determine when it can run and commit.
Definition: job_binlog.cpp:80
A job represents a single unit of work applied by worker pool threads.
Definition: job.h:47
unsigned int Thread_id
Type alias for thread identifier.
Definition: job.h:54
Managed event.
Definition: managed_event.h:35
Represents a MySQL Global Transaction Identifier.
Definition: gtid.h:47
static my_thread_id thread_id
Definition: my_thr_init.cc:60
Definition: channel.cpp:28
Transaction_phase
Lists all phases the Job_binlog can be in.
Definition: job_binlog.h:43
@ commit_register
Transaction prepare.
@ done
Done, successfully or with failure.
@ commit_binlog
Committing phase.
@ retry_commit
Retrying commit.
std::reference_wrapper< Statistics_instance_monitor > Statistics_instance_monitor_ref
Definition: statistics_instance_monitor.h:43
Instrumentation helpers for mutexes.