Internals
How the Raft DB storage engine, server, replication control plane and MySQL/MariaDB front-end are built, crate by crate, with the numbers of each.
- 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.
- Crate map: The crates of the Raft DB workspace, what each one is for, what it depends on, and the numeric targets kept in raftdb-core.
- raftdb-doc, the document format: The binary layout of a stored document, how fields are identified, how documents are read without decoding, and the measured size.
- raftdb-table, the hash index: How the segmented hash table maps a 64-bit hash to a 32-bit slot, how buckets are searched and split, and its memory cost.
- raftdb-store, the in-memory collection: The arena and index layout of the in-memory key-to-document map, its operations, compaction, snapshots and measured speed.
- raftdb-wal, the write-ahead log: The on-disk record format, group commit, recovery, failure behaviour and measured speed of the write-ahead log.
- raftdb-db, the durable table: How a table joins the schema, the in-memory store and the log; the write order, record types, checkpoints and the measured latency target that was not met.
- raftdb-schema, schema and type checking: How a document schema is modelled, how a document is validated without allocation, its stored form, and what it does not do yet.
- raftdb-exec, filter plans and the executor: The plan format, the JSON filter language and its strict typing, batched execution over document masks, ordering, and the SQL subset that compiles to the same plan.
- raftdb-proto, the wire protocol codec: The binary frame format, every request and reply kind, the parsing rules, protocol version 2 (streams) and measured codec speed.
- raftdb-client, the Rust client: The blocking Rust client, its one-shot and streaming calls, the bounded look before a blocking receive, and Mux streams that share connections.
- raftdb-server, the server: The threads of the server (connection, shard, flusher), databases and tables on disk, replication, roles, control-plane hooks and the engine choices, with measured throughput.
- raftdb-bloom, the cache-local bloom filter: How a one-cache-line bloom filter answers "definitely absent", its sizing, stored form and measured false-positive rate.
- raftdb-spsc, the cross-core message ring: The lock-free single-producer single-consumer ring used to model thread-per-core hand-off, its memory ordering, API and measured speed.
- Life of a write: What happens to an insert from the client's frame to the acknowledgement: shards, schema check, log, group commit, flusher, replicas and the lsm variant.
- Life of a read: How a point read, a filter scan, an index-assisted query and a sorted page are answered, in the in-memory and lsm engines.
- MVCC and transactions: What the raftdb-mvcc crate implements (version header, snapshot visibility, purge horizon), what is not connected to the server, and how transactions work in the MySQL front-end.
- Secondary indexes: How raftdb-index stores candidate keys, why a lookup returns a superset, how the table keeps indexes in step, and how the lsm engine stores them.
- The LSM engine (raftdb-lsm): The disk-resident storage engine: files, memtable and flush, leveled compaction, bounded recovery, write backpressure, block cache and the measured restart and latency figures.
- Raft and the control plane: The raftdb-raft state machine, how the watcher quorum uses it to choose one primary per group, the fence on the node, and what is not built.
- Watcher and error reports: What the raftdb-watch program checks and fixes, its quorum and resource control modules, and the rules of the raftdb-report fatal-error reports.
- Simulation tests (raftdb-sim): How deterministic simulation checks the write-ahead log and the whole table against crashes, torn writes and lying disks, and what it does not model.
- Portability: The rules that keep Raft DB behaving the same on every platform, the full inventory of platform-specific code, the support tiers and what has actually been run.
- The MySQL/MariaDB front-end (raftdb-mysql): How the connector program is built: its modules, how a table and a row are stored in Raft DB, how it runs in one process or two, how uniqueness and foreign keys are kept, and how it is tested against MySQL and MariaDB.
- MySQL and MariaDB dialects: How one front-end program answers as MySQL 8 or MariaDB 11, what the dialect setting changes, and how differences are found against MySQL and MariaDB.
- Expressions and types in the front-end: How MySQL's value rules, column types and expression result types are reproduced, how generated columns, checks and functional indexes use them, and the known gaps.
- Pushdown and the executor: How the front-end turns WHERE conditions into Raft DB filters, how its general SELECT executor runs, and the changes that made it level with MySQL in one process, with their records.
- Routines and triggers: How stored procedures, functions and triggers are stored and interpreted in the front-end, how several result sets are returned, and the limits.
- Decisions D40 to D88 in short: A one-paragraph summary of each design decision from D40 (UDP transport) to D88 (triggers), in order, with a pointer to the page that explains the mechanism.