Implement milestone #6 - Manifest files & startup recovery - #5
Merged
Merged
Conversation
aalhour
force-pushed
the
milestone/manifest
branch
4 times, most recently
from
May 25, 2026 19:12
b36a69a to
a087613
Compare
…codedSize-vs-Encode parity, tag-order independence, wider fuzz seeds, and a table-driven truncation suite.
…llestKey, idempotent deletes) and accessors, plus full tests for clone isolation, sort invariant, and defensive copies.
…ility and Close() func.
aalhour
force-pushed
the
milestone/manifest
branch
from
May 25, 2026 19:32
fb80cc5 to
4f26a0e
Compare
… into milestone/manifest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
VersionEditrecords instead of being rediscovered by directory scan; onOpenthe engine readsCURRENT, replays every edit into an immutable copy-on-writeVersion, opens readers for the surviving files, and resumes WAL replay from the persistedLastSequence. Same design as LevelDB/Pebble.List of changes:
internal/manifest:VersionEditTLV encode/decode, immutableVersionwith copy-on-writeApply(L1+ sorted by key, L0 in insertion order), fsync-per-AppendWriter, sequentialReaderwith partial-tail truncation, atomicCURRENTinstallengine/db.go: manifest bootstrap + replay onOpen, persist flushed SSTables viaVersionEdit, best-effort orphan-SSTable cleanupinternal/crashhook: manifest crash pointsmanifest_after_sst_sync,manifest_after_appendcmd/manifest_dump: inspect a manifest's edit streamexamples/engine/manifest: end-to-end flush-and-recover exampledocs/formats/manifest.md: byte-level wire formatciprofile) steps