Repository navigation
Layout F: packs never span types, and merges take one type's packs - #68
Merged
Merged
Conversation
This was referenced Oct 21, 2026
isTravis
marked this pull request as ready for review
October 21, 2026 20:00
isTravis
pushed a commit
that referenced
this pull request
Oct 21, 2026
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.
Stacked on #64 (base
upload-packs); retarget tomainonce #64 merges.On layout F a pack now closes where the record type changes, so no pack spans types, and pack merges take one type's packs at a time. That is requirement 9 of the layout ("no pack spans types or sets"), and it is the first of three steps toward leveled maintenance for daily updates: Layout F Daily Updates.
Why
Keys lead with the type, so a type's records are contiguous in key order. A pack that spans a type boundary still mixes the tail of one type with the head of the next, and tier merges then mix types across many packs. In the three-year simulation of Crossref's measured daily updates, a cold leaf read on
mainreaches 255 GETs at the median (2,556 at p99). With packs cut at types and merges within a type it is 72 (2,079 at p99). It still grows with every day (p90 345 at one year, 835 at three), so this does not replace leveled maintenance. It helps until that lands, and leveled maintenance needs it anyway.A real-code check of the simulator, with
mainpatched the same way, 150k records for 30 days of dailies: commit units matched exactly, pack counts within a few, and median pack GETs per leaf within one.What changed
PackWritercloses the current pack when a key's type differs from the last one's.PackInfogainstype, the one type a pack holds. It is absent on packs written before, and on keys without a type (some tests).#mergePacksqueues non-final packs by (tier, type) instead of by tier, and merges the longest queue. Packs without a type form their own queue and merge among themselves. A test caps a merge at 8 inputs: grouped, eight packs of one type make one pack of 32 records; mixed, they would make two of 16 and move up a tier half-full. The test fails on the old code.push_packsgets arecord_typecolumn (migration0027_push_pack_types), set from the pack-write hook.adoptSessionPackspasses it on, so an upload's small packs merge with their own type's packs once listed.Cost: a small type with fewer than 8 non-final packs in a tier waits to merge. In the simulation, 242–261 non-final packs stay listed in the manifest against 1–6 before. That's manifest entries, not reads: lookups go through the index.
Tests
Deploy
Migration
0027_push_pack_types(push_packs.record_type, nullable) goes with or before the deploy. It goes with #64's0026, or after it if that is already applied.Metric: new
packs/objects each hold one type (typeset in the manifest and registry); listed non-final packs stay in the low hundreds per set.Rollback: redeploy both Workers at their previous versions. Packs with
typeread the same, and the old merge ignores the field. The column can stay.