Internals overview
What the internals chapter covers, how the Raft DB code is divided into crates, and how to read the numbers on these pages.
This chapter describes how Raft DB is built. It is written for a reader who wants to know what happens inside the program: which crate does what, which data structures are used, what a write and a read go through, and where the limits are. It is not needed to use Raft DB.
Raft DB is a Rust workspace. The storage engine and server are separate crates with few dependencies, and the MySQL/MariaDB front-end is one more crate (raftdb-mysql) that talks to the server. The pages here describe each crate for a reader and give its measured numbers.
Layers#
MySQL / MariaDB client native client (Rust, other languages) Studio (browser)
| MySQL wire protocol | binary protocol / HTTP JSON | HTTP JSON
raftdb-mysql ----------------------> raftdb-server <------------------------------- +
(dialect, SQL, executor) (connections, shards, flushers, HTTP, replication)
|
raftdb-db (durable table) raftdb-lsm (disk-resident engine)
| | | | |
raftdb-store raftdb-wal raftdb-schema raftdb-wal raftdb-bloom
raftdb-table raftdb-index
raftdb-exec raftdb-doc (documents, filters)
raftdb-watch (separate program) -- raftdb-raft (election of the primary) -- raftdb-report (fatal-error reports)
raftdb-sim (deterministic simulation tests), raftdb-bench (benchmarks), raftdb-core (numeric targets)Pages#
| Group | Pages |
|---|---|
| Map | Crate map |
| Data structures | raftdb-doc, raftdb-table, raftdb-store, raftdb-bloom, raftdb-spsc, raftdb-schema, raftdb-exec |
| Durability and the server | raftdb-wal, raftdb-db, raftdb-proto, raftdb-client, raftdb-server |
| Paths | Life of a write, Life of a read |
| Concepts | MVCC, Secondary indexes, The LSM engine, Raft and the control plane, Watcher and error reports |
| Verification | Simulation tests, Portability |
| MySQL/MariaDB front-end | Front-end, Dialects, Expressions and types, Pushdown and the executor, Routines and triggers, Decisions D40-D88 in short |
How to read the numbers#
Every number on these pages comes from the crate's own record, the benchmark results log or the decision log. Most measurements were taken on one Windows 11 development PC with an NVMe drive; the LSM measurements were taken on a 2-vCPU Linux host. They are measurements of that machine on that day, not guarantees. Where a target was not met, the page says so.
For design reasons and rejected alternatives, see the design decisions chapter.