MySQL 26.7.0
Source Code Documentation
mysql::scheduler::Transaction_order_schedule Class Reference

Represents schedule for a transaction executing in two phases: apply and committing, where commit must follow the commit order. More...

#include <transaction_order_schedule.h>

Inheritance diagram for mysql::scheduler::Transaction_order_schedule:
[legend]

Public Types

enum class  Phase { prepare = 0 , commit = 1 }
 

Public Member Functions

 Transaction_order_schedule (Task_id task_id, Scheduler_clock_ptr trx_clock, uint64_t trx_time, Scheduler_clock_ptr commit_clock, uint64_t commit_time)
 Constructor. More...
 
bool next () override
 This function modifies the state of the schedule to next state. More...
 
const Time_delay_typeget_task_delay () const override
 Gets information about next execution time. More...
 
bool is_finished () const override
 
const Scheduler_clock_ptrget_clock () const override
 Obtain task clock. More...
 
const Task_idget_id () const override
 Obtain task id. More...
 
const Time_delay_typeget_phase_delay (unsigned int phase_id) const override
 Gets information about execution time in specific phase. More...
 
const Scheduler_clock_ptrget_phase_clock (unsigned int phase_id) const override
 Obtain task clock for the given phase id. More...
 
unsigned int get_phase_id () const override
 Returns current phase id (sequence number) More...
 
- Public Member Functions inherited from mysql::scheduler::Task_schedule
 Task_schedule ()
 Constructor sets the task delay to a given value. More...
 
bool has_higher_priority (const Task_schedule &arg, int phase) const
 Compare two task schedules to indicate which task should run first. More...
 
virtual ~Task_schedule ()=default
 Destructor. More...
 
void set_enqueued_by_scheduler ()
 Sets the flag indicating that the task was enqueued by the scheduler. More...
 
bool is_enqueued_by_scheduler () const
 Checks if the task was enqueued by the scheduler. More...
 
bool is_phase_ready () const
 Checks if the current phase is ready for execution. More...
 
void set_phase_ready ()
 Sets the phase ready flag to true. More...
 

Private Attributes

Task_id m_task_id
 This task id. More...
 
Scheduler_clock_ptr m_trx_clock
 Clock whole task schedule is based on. More...
 
uint64_t m_trx_time
 Transaction start execution time, relative to the m_trx_clock. More...
 
Scheduler_clock_ptr m_commit_clock
 Commit clock, dependency clock for commit phase. More...
 
uint64_t m_commit_time
 Transaction commit start time, relative to the commit clock. More...
 
unsigned int m_phase {0}
 Current schedule phase. More...
 

Detailed Description

Represents schedule for a transaction executing in two phases: apply and committing, where commit must follow the commit order.

Member Enumeration Documentation

◆ Phase

Enumerator
prepare 
commit 

Constructor & Destructor Documentation

◆ Transaction_order_schedule()

mysql::scheduler::Transaction_order_schedule::Transaction_order_schedule ( Task_id  task_id,
Scheduler_clock_ptr  trx_clock,
uint64_t  trx_time,
Scheduler_clock_ptr  commit_clock,
uint64_t  commit_time 
)

Constructor.

constructs schedule for tranctions executing commit order

Parameters
task_idTask identifier
trx_clockClock transaction schedule is based on
trx_timeDelay w.r.t. trx_clock start point
commit_clockClock transaction commit schedule is based on
commit_timeDelay w.r.t. trx_clock start point

Member Function Documentation

◆ get_clock()

const Scheduler_clock_ptr & mysql::scheduler::Transaction_order_schedule::get_clock ( ) const
overridevirtual

Obtain task clock.

Implements mysql::scheduler::Task_schedule.

◆ get_id()

const Task_id & mysql::scheduler::Transaction_order_schedule::get_id ( ) const
overridevirtual

Obtain task id.

Implements mysql::scheduler::Task_schedule.

◆ get_phase_clock()

const Scheduler_clock_ptr & mysql::scheduler::Transaction_order_schedule::get_phase_clock ( unsigned int  phase_id) const
overridevirtual

Obtain task clock for the given phase id.

Parameters
phase_idSelected phase sequence number

Reimplemented from mysql::scheduler::Task_schedule.

◆ get_phase_delay()

const Time_delay_type & mysql::scheduler::Transaction_order_schedule::get_phase_delay ( unsigned int  phase_id) const
overridevirtual

Gets information about execution time in specific phase.

Parameters
phase_idSelected phase sequence number

Reimplemented from mysql::scheduler::Task_schedule.

◆ get_phase_id()

unsigned int mysql::scheduler::Transaction_order_schedule::get_phase_id ( ) const
overridevirtual

Returns current phase id (sequence number)

Returns
Phase sequence number

Reimplemented from mysql::scheduler::Task_schedule.

◆ get_task_delay()

const Time_delay_type & mysql::scheduler::Transaction_order_schedule::get_task_delay ( ) const
overridevirtual

Gets information about next execution time.

Returns
Current phase task delay

Implements mysql::scheduler::Task_schedule.

◆ is_finished()

bool mysql::scheduler::Transaction_order_schedule::is_finished ( ) const
overridevirtual
Note
TBI in derived

Implements mysql::scheduler::Task_schedule.

◆ next()

bool mysql::scheduler::Transaction_order_schedule::next ( )
overridevirtual

This function modifies the state of the schedule to next state.

Returns
false - Task is one-shot task, won't be executed in the future

Implements mysql::scheduler::Task_schedule.

Member Data Documentation

◆ m_commit_clock

Scheduler_clock_ptr mysql::scheduler::Transaction_order_schedule::m_commit_clock
private

Commit clock, dependency clock for commit phase.

◆ m_commit_time

uint64_t mysql::scheduler::Transaction_order_schedule::m_commit_time
private

Transaction commit start time, relative to the commit clock.

◆ m_phase

unsigned int mysql::scheduler::Transaction_order_schedule::m_phase {0}
private

Current schedule phase.

◆ m_task_id

Task_id mysql::scheduler::Transaction_order_schedule::m_task_id
private

This task id.

◆ m_trx_clock

Scheduler_clock_ptr mysql::scheduler::Transaction_order_schedule::m_trx_clock
private

Clock whole task schedule is based on.

◆ m_trx_time

uint64_t mysql::scheduler::Transaction_order_schedule::m_trx_time
private

Transaction start execution time, relative to the m_trx_clock.


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