![]() |
MySQL 26.7.0
Source Code Documentation
|
A job represents a single unit of work applied by worker pool threads. More...
#include <job.h>
Public Types | |
| using | Thread_id = unsigned int |
| Type alias for thread identifier. More... | |
Public Member Functions | |
| Job (const Job &)=delete | |
| Deleted copy constructor. More... | |
| Job & | operator= (const Job &)=delete |
| Deleted assignment operator. More... | |
| Job (unsigned int max_retries) | |
| Constructor. More... | |
| virtual | ~Job () |
| Destructor. More... | |
| virtual unsigned int | get_instance_id () const |
| Obtains unique instance id to gather statistics separately for different "instances". More... | |
| virtual bool | is_trx () const |
| Checks whether handled job is a transaction (supports two phases) More... | |
| virtual bool | restart () |
| Resets the job for retrying. More... | |
| virtual bool | run (Thread_id thread_id)=0 |
| Implements execution of the full job or a single job phase. More... | |
| virtual bool | attach (Thread_id thread_id)=0 |
| Attaches the job. More... | |
| Thread_id | get_attach_id () const |
| Returns an id based on which the job attaches to applier context. More... | |
| virtual bool | detach (Thread_id thread_id)=0 |
| Detaches the job. More... | |
| virtual std::size_t | get_id () const |
| Gets the job identifier. More... | |
| virtual void | inc_retries () |
| Increments the number of retries for the job. More... | |
| virtual bool | can_be_retried () |
| Checks whether this job can be retried. More... | |
| virtual unsigned int | get_retries () const |
| Gets the number of retries for this job. More... | |
| virtual bool | is_error () |
| Checks whether this job is in error state. More... | |
| virtual bool | is_stopped () const |
| Checks whether applier stop has been requested for this job. More... | |
| virtual bool | is_fatal_error () |
| Checks whether job has a fatal, non-recoverable error. More... | |
| virtual void | set_applier_stop (std::atomic< bool > &applier_stop) |
| Injects the applier stop flag for this job. More... | |
| virtual void | set_success () |
| Global job success callback. More... | |
| virtual void | set_failure () |
| Global job failure callback. More... | |
| virtual void | set_fatal_error () |
| Sets fatal job error. More... | |
| virtual void | set_error () |
| Sets job error. More... | |
| virtual void | set_done () |
| Sets this job as done. More... | |
| virtual bool | is_done () |
| Checks whether the job is done. More... | |
| virtual bool | is_attached () const =0 |
| Checks whether the job is currently attached. More... | |
| virtual std::string | to_string () |
| Converts the job to a string representation. More... | |
| virtual void | skip () |
| Skip this job, considered complete and done without failure. More... | |
Protected Attributes | |
| bool | m_is_error {false} |
| Error flag for job. More... | |
| bool | m_is_fatal_error {false} |
| Specifies if this job has a fatal error - we cannot retry it. More... | |
| bool | m_is_done {false} |
| When set to true, job is done (successfully or not) More... | |
| unsigned int | m_max_retries |
| Maximum number of retries for this job. More... | |
| std::size_t | m_id {0} |
| This job sequence id. More... | |
| Thread_id | m_thread_id {0} |
| Worker pool thread id. More... | |
| std::size_t | m_trx_retries {0} |
| The number of times this job was retried. More... | |
| std::reference_wrapper< std::atomic< bool > > | m_applier_stop |
| Channel stop flag used to interrupt wait loops. More... | |
Static Protected Attributes | |
| static std::atomic< std::size_t > | next_id = 0 |
| Next job id. Used to generate ids for jobs. More... | |
A job represents a single unit of work applied by worker pool threads.
Job defines execution path, the number of times the job runs, the number of retries, how job attaches to applier context and detaches from it. This is an abstract class for a job.
| using mysql::csa::Job::Thread_id = unsigned int |
Type alias for thread identifier.
|
delete |
Deleted copy constructor.
| mysql::csa::Job::Job | ( | unsigned int | max_retries | ) |
Constructor.
| max_retries | The number of times a job can be retried. |
|
virtual |
Destructor.
|
pure virtual |
Attaches the job.
| thread_id | Thread pool worker identifier |
Implemented in mysql::csa::Job_applier.
|
virtual |
Checks whether this job can be retried.
Reimplemented in mysql::csa::Job_applier.
|
pure virtual |
Detaches the job.
| thread_id | Thread pool worker identifier |
Implemented in mysql::csa::Job_applier.
| Job::Thread_id mysql::csa::Job::get_attach_id | ( | ) | const |
Returns an id based on which the job attaches to applier context.
|
virtual |
Gets the job identifier.
|
virtual |
Obtains unique instance id to gather statistics separately for different "instances".
Reimplemented in mysql::csa::Job_binlog.
|
virtual |
Gets the number of retries for this job.
|
virtual |
Increments the number of retries for the job.
|
pure virtual |
Checks whether the job is currently attached.
Implemented in mysql::csa::Job_applier.
|
virtual |
Checks whether the job is done.
|
virtual |
Checks whether this job is in error state.
|
virtual |
Checks whether job has a fatal, non-recoverable error.
|
virtual |
Checks whether applier stop has been requested for this job.
|
virtual |
Checks whether handled job is a transaction (supports two phases)
Reimplemented in mysql::csa::Job_binlog.
|
virtual |
Resets the job for retrying.
This must be called before retrying, so that the internal pointers are reset to the proper place.
Reimplemented in mysql::csa::Job_applier, and mysql::csa::Job_binlog.
|
pure virtual |
Implements execution of the full job or a single job phase.
| thread_id | Thread pool worker identifier |
Implemented in mysql::csa::Job_binlog.
|
virtual |
Injects the applier stop flag for this job.
| applier_stop | Stop flag reference. |
|
virtual |
Sets this job as done.
Reimplemented in mysql::csa::Job_binlog.
|
virtual |
Sets job error.
|
virtual |
Global job failure callback.
Reimplemented in mysql::csa::Job_applier.
|
virtual |
Sets fatal job error.
|
virtual |
Global job success callback.
Reimplemented in mysql::csa::Job_binlog.
|
inlinevirtual |
Skip this job, considered complete and done without failure.
Reimplemented in mysql::csa::Job_binlog.
|
virtual |
Converts the job to a string representation.
Reimplemented in mysql::csa::Job_applier.
|
protected |
Channel stop flag used to interrupt wait loops.
|
protected |
This job sequence id.
|
protected |
When set to true, job is done (successfully or not)
|
protected |
Error flag for job.
|
protected |
Specifies if this job has a fatal error - we cannot retry it.
|
protected |
Maximum number of retries for this job.
|
protected |
Worker pool thread id.
|
protected |
The number of times this job was retried.
|
staticprotected |
Next job id. Used to generate ids for jobs.