Sep 2026 - Present
YASE - Yet Another Storage Engine
A learning project. Building a relational database storage engine from scratch in C++17.
- C++17
- POSIX
- Multithreading
- GoogleTest
- CMake
Goal
I wanted to understand how a database actually stores data, below the SQL. So I'm building the storage layer myself: how pages move between disk and memory, what stays cached, and when writes reach disk.
Design choices
- Direct I/O. A block-based storage layer opens files with
O_DIRECTand uses 4 KB-aligned buffers to bypass the kernel page cache. Thread-safepread/pwritecalls and lock-free atomic page allocation let many threads do I/O at once. - Buffer pool manager. An O(1) LRU replacer with pin counting and dirty-page write-back. Pinned frames are never evicted, and modified pages are flushed before their frame is reused.
- Heap files. Bitmapped data pages plus a directory-based heap file in which each directory page tracks 1,024 data pages. Record IDs are stable, bit-packed 64-bit values.
What I learned
- Why databases manage their own memory instead of trusting the OS page cache.
- How to keep invariants like "pinned pages are never evicted" true under concurrency, and how to test them with GoogleTest.











