24#ifndef MYSQL_CSA_JOB_H
25#define MYSQL_CSA_JOB_H
58 Job(
unsigned int max_retries);
67 virtual bool is_trx()
const;
90 virtual std::size_t
get_id()
const;
A job represents a single unit of work applied by worker pool threads.
Definition: job.h:47
virtual bool is_fatal_error()
Checks whether job has a fatal, non-recoverable error.
Definition: job.cpp:80
virtual std::size_t get_id() const
Gets the job identifier.
Definition: job.cpp:64
bool m_is_error
Error flag for job.
Definition: job.h:135
virtual bool restart()
Resets the job for retrying.
Definition: job.cpp:55
Job & operator=(const Job &)=delete
Deleted assignment operator.
std::size_t m_id
This job sequence id.
Definition: job.h:145
virtual bool is_error()
Checks whether this job is in error state.
Definition: job.cpp:74
virtual void set_failure()
Global job failure callback.
Definition: job.cpp:88
virtual void inc_retries()
Increments the number of retries for the job.
Definition: job.cpp:66
bool m_is_fatal_error
Specifies if this job has a fatal error - we cannot retry it.
Definition: job.h:137
virtual void set_applier_stop(std::atomic< bool > &applier_stop)
Injects the applier stop flag for this job.
Definition: job.cpp:82
Thread_id m_thread_id
Worker pool thread id.
Definition: job.h:147
virtual bool detach(Thread_id thread_id)=0
Detaches the job.
virtual bool attach(Thread_id thread_id)=0
Attaches the job.
virtual unsigned int get_retries() const
Gets the number of retries for this job.
Definition: job.cpp:72
std::reference_wrapper< std::atomic< bool > > m_applier_stop
Channel stop flag used to interrupt wait loops.
Definition: job.h:151
Thread_id get_attach_id() const
Returns an id based on which the job attaches to applier context.
Definition: job.cpp:62
virtual bool is_attached() const =0
Checks whether the job is currently attached.
virtual void set_success()
Global job success callback.
Definition: job.cpp:86
unsigned int Thread_id
Type alias for thread identifier.
Definition: job.h:54
virtual bool is_done()
Checks whether the job is done.
Definition: job.cpp:103
virtual bool run(Thread_id thread_id)=0
Implements execution of the full job or a single job phase.
Job(const Job &)=delete
Deleted copy constructor.
virtual bool can_be_retried()
Checks whether this job can be retried.
Definition: job.cpp:68
std::size_t m_trx_retries
The number of times this job was retried.
Definition: job.h:149
virtual bool is_stopped() const
Checks whether applier stop has been requested for this job.
Definition: job.cpp:76
virtual unsigned int get_instance_id() const
Obtains unique instance id to gather statistics separately for different "instances".
Definition: job.cpp:51
virtual void skip()
Skip this job, considered complete and done without failure.
Definition: job.h:131
virtual void set_fatal_error()
Sets fatal job error.
Definition: job.cpp:90
bool m_is_done
When set to true, job is done (successfully or not)
Definition: job.h:139
virtual void set_error()
Sets job error.
Definition: job.cpp:96
virtual void set_done()
Sets this job as done.
Definition: job.cpp:101
static std::atomic< std::size_t > next_id
Next job id. Used to generate ids for jobs.
Definition: job.h:143
virtual ~Job()
Destructor.
Definition: job.cpp:49
virtual bool is_trx() const
Checks whether handled job is a transaction (supports two phases)
Definition: job.cpp:53
virtual std::string to_string()
Converts the job to a string representation.
Definition: job.cpp:105
unsigned int m_max_retries
Maximum number of retries for this job.
Definition: job.h:141
Defines for getting and processing the current system type programmatically.
static my_thread_id thread_id
Definition: my_thr_init.cc:60
Definition: channel.cpp:28