![]() |
MySQL 26.7.0
Source Code Documentation
|
Clock implementation that computes LWM (Low Water Mark) based on executed tasks. More...
#include <clock_lwm_registry.h>
Classes | |
| struct | Task_state |
| This structure is used to represent a registered task state and update LWM. More... | |
Public Member Functions | |
| Clock_lwm_registry (std::size_t clock_capacity=8192, Scheduler_clock_psi psi_params={}) | |
| Construct the clock - initializes the internal task registry Since we use spin lock in this implementation, we skip PSI instrumentation. More... | |
| Time_point_t | now () const override |
| Get the current value of the LWM. More... | |
| Time_point_t | start_time () const override |
| Get start time of this clock - the first LWM value (0) More... | |
| bool | add_time (Task_id task_id, Time_point_t) override |
| Registers a task to execute at specific LWM. More... | |
| bool | tick (Task_id task_id, Time_point_t) override |
| Tick performed on the clock when task finishes. More... | |
| void | test_set_current_lwm (Time_point_t lwm) |
| Backdoor for unit tests to set LWM to a specific value. More... | |
Public Member Functions inherited from mysql::scheduler::Scheduler_clock | |
| virtual | ~Scheduler_clock ()=default |
| Destructor. More... | |
| virtual bool | advances_independently () const |
| Returns property of a clock - information on whether this clock is steered by task ticks or advances independently. More... | |
| virtual bool | try_unblock () |
| Maintenance function for unblocking the clock. More... | |
| virtual Scheduler_dependency_type | get_type () const |
| Typical scheduler clock dependency type is end to start. More... | |
Private Attributes | |
| Task_registry_multi< Task_id, Task_state > | m_executed_registry |
| Registry of executed tasks. More... | |
| std::atomic< Time_point_t > | m_current_lwm {0} |
| Current LWM value. More... | |
Additional Inherited Members | |
Public Types inherited from mysql::scheduler::Scheduler_clock | |
| using | Time_point_t = uint64_t |
Clock implementation that computes LWM (Low Water Mark) based on executed tasks.
This class provides a Scheduler_clock interface where the "time" is represented by the LWM, which can be defined in two equivalent ways:
Internally, this class uses a Task_registry_multi to track the state of tasks (registered, started, finished). It maintains an atomic LWM value, updated when tasks finish execution via the tick() method. The LWM advances to the maximum ID where all tasks up to that ID are finished.
Key Identifiers (Internal to this Class):
Performance Characteristics:
API Overview:
Relation to External Components (e.g., CSA): This class is designed for use in systems like Change Stream Apply (CSA), where:
|
inline |
Construct the clock - initializes the internal task registry Since we use spin lock in this implementation, we skip PSI instrumentation.
| clock_capacity | The maximum number of tasks this clock may handle |
| psi_params | Instrumentation |
|
overridevirtual |
Registers a task to execute at specific LWM.
Here, we don't need to know at which LWM task executes.
| task_id | Id of the task that finished execution |
Implements mysql::scheduler::Scheduler_clock.
|
overridevirtual |
Get the current value of the LWM.
Implements mysql::scheduler::Scheduler_clock.
|
overridevirtual |
Get start time of this clock - the first LWM value (0)
Implements mysql::scheduler::Scheduler_clock.
| void mysql::scheduler::Clock_lwm_registry::test_set_current_lwm | ( | Time_point_t | lwm | ) |
Backdoor for unit tests to set LWM to a specific value.
|
overridevirtual |
Tick performed on the clock when task finishes.
| task_id | Id of the task that finished execution |
Implements mysql::scheduler::Scheduler_clock.
|
private |
Current LWM value.
|
private |
Registry of executed tasks.
Concurrency is covered by the Task Registry Multi (handles id conflicts)