Skip to content

Implement milestone #6 - Manifest files & startup recovery - #5

Merged
aalhour merged 27 commits into
mainfrom
milestone/manifest
May 29, 2026
Merged

aalhour merged 27 commits into
mainfrom
milestone/manifest

Conversation

@aalhour

@aalhour aalhour commented May 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR implements BeachDB's MANIFEST log and CURRENT pointer. Both comprise the on-disk catalog tracking which SSTables exist across restarts, in addition to the startup recovery that rebuilds the engine's state from it.

Flushed SSTables are also now recorded as durable, TLV-encoded VersionEdit records instead of being rediscovered by directory scan; on Open the engine reads CURRENT, replays every edit into an immutable copy-on-write Version, opens readers for the surviving files, and resumes WAL replay from the persisted LastSequence. Same design as LevelDB/Pebble.

List of changes:

  • internal/manifest: VersionEdit TLV encode/decode, immutable Version with copy-on-write Apply (L1+ sorted by key, L0 in insertion order), fsync-per-Append Writer, sequential Reader with partial-tail truncation, atomic CURRENT install
  • engine/db.go: manifest bootstrap + replay on Open, persist flushed SSTables via VersionEdit, best-effort orphan-SSTable cleanup
  • internal/crashhook: manifest crash points manifest_after_sst_sync, manifest_after_append
  • cmd/manifest_dump: inspect a manifest's edit stream
  • examples/engine/manifest: end-to-end flush-and-recover example
  • docs/formats/manifest.md: byte-level wire format
  • CI/Makefile: run CI once per PR + on push to main/master, add examples and crash-harness (ci profile) steps

@aalhour
aalhour force-pushed the milestone/manifest branch 4 times, most recently from b36a69a to a087613 Compare May 25, 2026 19:12
@aalhour
aalhour force-pushed the milestone/manifest branch from fb80cc5 to 4f26a0e Compare May 25, 2026 19:32
@aalhour
aalhour merged commit 98c1c88 into main May 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant