MySQL 26.7.0
Source Code Documentation
mysql::csa::Task_exec_job Class Reference

A task that executes a job in the change streams apply system. More...

#include <task_exec_job.h>

Public Types

using Task_result = mysql::scheduler::Task_result
 Type alias for the task result from the mysql scheduler. More...
 
using Session_service_ptr = mysql::csa::Session_service_ptr
 Type alias for the session service in change streams apply. More...
 
using Stat_monitor_ref = scheduler::Statistics_instance_monitor_ref
 Type alias for the statistics monitor instance for the channel. More...
 

Public Member Functions

bool is_error () const
 Checks if task executed with an error - this function is called by Scheduler to get task status. More...
 
 Task_exec_job (Job_ptr job, uint64_t job_id, Session_service_ptr session_service, Stat_monitor_ref stat_monitor, std::atomic< bool > &stop_ref)
 Constructor. More...
 
Task_result operator() (unsigned int thread_id)
 This function executes a job. More...
 

Private Member Functions

Task_result run (Job *job, uint64_t job_id, unsigned int thread_id)
 Function executing a job - internal implementation. More...
 
void set_error ()
 Indicates that a task executed with a non-recoverable error (stop) More...
 

Private Attributes

bool m_is_error {false}
 Internal error flag. More...
 
std::shared_ptr< Jobm_job
 Shared job handle provided by the job provider. More...
 
uint64_t m_job_id {0}
 Job id assigned by the job provider. More...
 
Session_service_ptr m_session_service
 Assigned session service handle. More...
 
bool m_started {false}
 Checks if task has been started. More...
 
scheduler::Statistics_instance_monitor_ref m_stat_monitor
 Statistics monitoring object for the current instance. More...
 
std::atomic< bool > & m_applier_stop
 If retried, this flag will be checked to determine whether applier has been stopped. More...
 

Detailed Description

A task that executes a job in the change streams apply system.

It handles job execution, potential retries on failures, and error management.

Member Typedef Documentation

◆ Session_service_ptr

Type alias for the session service in change streams apply.

◆ Stat_monitor_ref

Type alias for the statistics monitor instance for the channel.

◆ Task_result

Type alias for the task result from the mysql scheduler.

Constructor & Destructor Documentation

◆ Task_exec_job()

mysql::csa::Task_exec_job::Task_exec_job ( Job_ptr  job,
uint64_t  job_id,
Session_service_ptr  session_service,
Stat_monitor_ref  stat_monitor,
std::atomic< bool > &  stop_ref 
)

Constructor.

Parameters
jobJob handle created by the job provider
job_idJob id assigned by the job provider
session_serviceHandle to session service, providing sessions to which this job can attach.
stat_monitorStatistic monitoring object
stop_refIf retried, this flag will be checked to determine whether applier has been stopped. Otherwise, we skip this check for performance

Member Function Documentation

◆ is_error()

bool mysql::csa::Task_exec_job::is_error ( ) const

Checks if task executed with an error - this function is called by Scheduler to get task status.

◆ operator()()

Task_result mysql::csa::Task_exec_job::operator() ( unsigned int  thread_id)

This function executes a job.

If job fails and can be retried, job is reexecuted. In case retry fails or is not possible, error is written into the job, function returns an error, causing scheduler to stop

◆ run()

Task_result mysql::csa::Task_exec_job::run ( Job job,
uint64_t  job_id,
unsigned int  thread_id 
)
private

Function executing a job - internal implementation.

Parameters
jobJob pointer
job_idInternal job identifier
thread_idThread pool worker identifier
See also
operator()

This is early return for multiple phase tasks returning in early phases

◆ set_error()

void mysql::csa::Task_exec_job::set_error ( )
private

Indicates that a task executed with a non-recoverable error (stop)

Member Data Documentation

◆ m_applier_stop

std::atomic<bool>& mysql::csa::Task_exec_job::m_applier_stop
private

If retried, this flag will be checked to determine whether applier has been stopped.

Otherwise, we skip this check for performance

◆ m_is_error

bool mysql::csa::Task_exec_job::m_is_error {false}
private

Internal error flag.

◆ m_job

std::shared_ptr<Job> mysql::csa::Task_exec_job::m_job
private

Shared job handle provided by the job provider.

◆ m_job_id

uint64_t mysql::csa::Task_exec_job::m_job_id {0}
private

Job id assigned by the job provider.

◆ m_session_service

Session_service_ptr mysql::csa::Task_exec_job::m_session_service
private

Assigned session service handle.

◆ m_started

bool mysql::csa::Task_exec_job::m_started {false}
private

Checks if task has been started.

◆ m_stat_monitor

scheduler::Statistics_instance_monitor_ref mysql::csa::Task_exec_job::m_stat_monitor
private

Statistics monitoring object for the current instance.


The documentation for this class was generated from the following files: