cpp-db
cpp-db is a page-oriented storage manager written in C++. It coordinates fixed-size pages between disk and an in-memory buffer pool using atomic frame transitions and a write-ahead log that records changes before dirty pages are flushed.
- Buffer frames transition across INVALID → LOADING → RESIDENT → DIRTY → FLUSHING via atomic compare-and-swap operations, while pin counts prevent active pages from being evicted.
- Large database files read through memory-mapped regions for zero-copy access, while smaller segments fall back to positional pread and pwrite calls.
- Each dirty-page change is appended to the log with its log sequence number, page ID, and changed bytes before the buffer pool flushes it.