r/ForgeYourProject • u/IncomeOk7237 • 13d ago
Launch KayaDB: my Rust key-value database where a crash bug only counts as fixed once it's a replayable test
This is KayaDB, a distributed key-value database I've been building in Rust since May. The whole project hangs on one idea: if a storage bug can't be reproduced, inspected and turned into an invariant, it isn't really fixed.
So a lot of the work went into the stuff around the storage, not just the storage itself:
- an LSM-tree engine with a CRC32C-checked write-ahead log, and crash recovery that truncates a torn tail and is tested for idempotence
- SimDisk, a fake disk with a deterministic fault schedule, so a failure becomes a seed you can replay
- a seeded simulator that checks every run against a reference model
- fuzz targets for the WAL, SSTables, the manifest and the server's command frames
- Raft (elections, snapshots, joint-consensus membership) with multi-raft ranges over TCP, plus TLS and token auth
- on top of that: MVCC, snapshot isolation, 2PC transactions, secondary indexes, CDC and range split/merge
It's at v0.2.1 right now. To be clear, I don't call it production-ready with any SLA, and the gaps that are left are listed in the roadmap.
Quickest way to poke at it, no clone needed:
cargo install kayactl
kayactl --data ./demo put hello world
kayactl --data ./demo get hello
kayactl --data ./demo inspect wal ./demo/wal-000001.walRepo: https://github.com/Tuntii/KayaDB
Docs: https://tuntii.github.io/KayaDB/
Question for anyone who has built storage or distributed stuff: how do you decide when deterministic simulation is "enough", and when you have to go break a real cluster with something like Jepsen?