Module tikv::storage::txn::scheduler [−][src]
Scheduler which schedules the execution of storage::Command
s.
There is one scheduler for each store. It receives commands from clients, executes them against the MVCC layer storage engine.
Logically, the data organization hierarchy from bottom to top is row -> region -> store -> database. But each region is replicated onto N stores for reliability, the replicas form a Raft group, one of which acts as the leader. When the client read or write a row, the command is sent to the scheduler which is on the region leader’s store.
Scheduler runs in a single-thread event loop, but command executions are delegated to a pool of worker thread.
Scheduler keeps track of all the running commands and uses latches to ensure serialized access to the overlapping rows involved in concurrent commands. But note that scheduler only ensures serialized access to the overlapping rows at command level, but a transaction may consist of multiple commands, therefore conflicts may happen at transaction level. Transaction semantics is ensured by the transaction protocol implemented in the client library, which is transparent to the scheduler.
Structs
CmdTimer | |
Scheduler | Scheduler which schedules the execution of |
SchedulerInner | |
Task | Task is a running command. |
TaskContext |
Constants
DEFAULT_EXECUTION_DURATION_LIMIT | |
TASKS_SLOTS_NUM |
Functions
id_index |