MMDB is a pure-Rust LSM-Tree key-value storage engine, optimized as the backend for vsdb. It implements leveled compaction, WAL-based crash recovery, MVCC snapshots, and lock-free reads via ArcSwap<SuperVersion>.
make all # fmt + lint + test
make test # cargo test && cargo test --release
make lint # cargo clippy --all-targets -- -D warnings
make bench # cargo bench (criterion)
cargo test --test integration # integration tests only
cargo test --test crash_recovery
cargo test --test e2e_scenarios
cargo test --test proptest_dbMSRV: Rust 1.89 (edition 2024)
| Subsystem | Key files | Purpose |
|---|---|---|
| Write path | src/db.rs |
Group commit: WAL → MemTable |
| Read path | src/db.rs |
Lock-free via ArcSwap<SuperVersion> |
| MemTable | src/memtable/ |
Lock-free skiplist (single-writer, multi-reader) |
| WAL | src/wal/ |
Crash recovery, block-based records with CRC32 |
| SST | src/sst/ |
Prefix-compressed blocks, bloom filters, LZ4/Zstd |
| Iterator | src/iterator/ |
Heap merge, range tombstones, bidirectional |
| Compaction | src/compaction/leveled.rs |
Leveled strategy, sub-compaction parallelism |
| Manifest | src/manifest/ |
VersionSet, atomic version edits |
| Cache | src/cache/ |
Block cache (moka LRU), table handle cache |
/x-review— deep regression analysis of recent changes/x-fix— fix audit backlog: resolve.claude/audit.md→ self-review → commit/x-commit— self-reviewing commit: review uncommitted changes → fix → commit/x-overhaul— full codebase overhaul: review all → fix → commit
Supporting documentation in .claude/docs/:
technical-patterns.md— cataloged bug patterns for LSM-Tree/Rustreview-core.md— systematic review methodologyfalse-positive-guide.md— rules for filtering spurious findingspatterns/— per-subsystem review guides (compaction, iterator, WAL, SST, memtable, concurrency, unsafe-audit)
- All clippy warnings are errors (CI enforced)
- No
#[allow(...)]— fix warnings at the source, never suppress them - Prefer imports over inline paths — avoid
std::foo::Bar::new()inline in function bodies when the same path appears 3+ times in a file; adduse std::foo;at file top (oruse std::foo::Bar;) instead. Function-bodyusestatements (scoped imports) are fine and don't count as inline paths. 1-2 inline uses of commonstd::items are acceptable. - Grouped imports — merge common prefixes:
use std::sync::{Arc, Mutex}; - Doc-code alignment — public API changes must update corresponding docs
parking_lotfor Mutex/RwLock (non-reentrant, no poisoning)thiserrorfor error typestracingfor logging- Tests use
tempfilefor isolated DB directories - Feature
test-utilsexposesDB::simulate_crash()for durability tests - ~76 unsafe blocks, concentrated in skiplist and block parsing — all require
// SAFETY:comments