Repository navigation
The projection's three holds go behind one pointer - #218
Merged
Merged
Conversation
`restore_until_ms`, `retention_until_ms` and `legal_hold` describe an object under a restore, a retention or a legal hold. Most objects are under none, and paid sixteen bytes of struct to say so. ObjectProjection 72 -> 64 the metaserver's share 200 -> 192 the metadata line 418 -> 410, fixed term unchanged `ObjectLock` already makes this argument on the object side -- its own doc says an object under none of the three should pay eight bytes rather than twenty-five -- and this is the same argument one level in. IT IS SMALL BECAUSE THE PROJECTION HAS ONE BUILDER AND ONE READER `from_metadata` is the only place a projection is constructed and `to_text` the only place its fields are read, so the change is two functions and three accessors. Zero compile errors followed it. `to_text` is also the WIRE FORM -- a record's value is its rendered characters, which is what every proof and every snapshot carries -- so the text is unchanged and `the_packed_projection_spells_the_same_text` passes untouched. A representation change. THE AUDIT HAD TO MOVE OR THE FIGURE WOULD BE A LIE `RecordValue::heap_bytes` charged a projection `size_of::<ObjectProjection>()` and nothing else. With the holds behind a pointer that under-reports every object that HAS one, which would publish a saving those objects did not get. It charges `holds_heap_bytes()` beside the struct now. THE HAZARD THE BOX CREATES, AND THE GUARD FOR IT `RecordValue` compares `Projection` to `Projection` with a DERIVED `PartialEq`. So a `None` box and an all-zero box would be DIFFERENT VALUES while spelling IDENTICAL TEXT -- and the type's own doc says two values that spell the same thing are the same value. `from_metadata` therefore builds the box only when one of the three is set, and `a_projection_holds_nothing_for_an_object_under_no_hold` asserts that rather than trusting the `.then(..)` to keep saying so: an object under none owes zero heap and still spells `restore_until_ms=0 legal_hold=false retention_until_ms=0`, an object under a legal hold owes the box, and the two are different values. It is pinned, because an equality invariant a document depends on belongs in the pinned set. FIVE MIRRORS WERE MEASURING AGAINST THE OLD BASELINE Across two measurements, five mirrors spelled the three holds inline. Left alone one of them read as saving MINUS EIGHT -- a number that looks like a result and is not. They follow the landed baseline now, and they name the real `ProjectedHolds` rather than a local copy of it: a mirror of a real type should name that type where it can, because a local duplicate is one more thing to drift. THE FIGURES, EACH RE-MEASURED 4 KiB amplification row 3.12x -> 3.11x striped 2.10x -> 2.09x metadata an object at 100 / 1,000 / 4,000 / 8,000 618 / 574 / 451 / 430 delete trade holding 1,831,649, emptied 2,300,662, 25.5% -> 25.6% larger the share table objects 210 (51.2%), records 192 (46.8%), keys 8 (2.0%) MEASURED Suite: 408 passing on the default feature set and 429 with every feature, with the same 21 failures in both, name for name the baseline in tools/known_failures.txt. Green on cargo build --all-targets for both feature sets with warnings denied, and on cargo doc for both. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
restore_until_ms,retention_until_msandlegal_holddescribe an object under a restore,a retention or a legal hold. Most objects are under none, and paid sixteen bytes of struct to
say so.
ObjectProjectionObjectLockalready makes this argument on the object side — its own doc says an objectunder none of the three should pay eight bytes rather than twenty-five — and this is the same
argument one level in.
It is small because the projection has one builder and one reader
from_metadatais the only place a projection is constructed, andto_textthe only placeits fields are read. So the change is two functions and three accessors, and zero compile
errors followed it.
to_textis also the wire form — a record's value is its rendered characters, which iswhat every proof and every snapshot carries — so the text is unchanged and
the_packed_projection_spells_the_same_textpasses untouched. A representation change.The audit had to move or the figure would be a lie
RecordValue::heap_bytescharged a projectionsize_of::<ObjectProjection>()and nothingelse. With the holds behind a pointer that under-reports every object that has one, which
would publish a saving those objects did not get. It charges
holds_heap_bytes()beside thestruct now.
The hazard the box creates, and the guard for it
RecordValuecomparesProjectiontoProjectionwith a derivedPartialEq. So aNonebox and an all-zero box would be different values while spelling identical text —and the type's own doc says two values that spell the same thing are the same value.
from_metadatatherefore builds the box only when one of the three is set, anda_projection_holds_nothing_for_an_object_under_no_holdasserts that rather than trustingthe
.then(..)to keep saying so:restore_until_ms=0,legal_hold=false,retention_until_ms=0;not about an accessor that always returns zero;
It is pinned: an equality invariant that a document depends on belongs in the pinned set.
Five mirrors were measuring against the old baseline
Across two measurements, five mirrors spelled the three holds inline. Left alone, one of them
read as saving minus eight — a number that looks like a result and is not. They follow
the landed baseline now, and they name the real
ProjectedHoldsinstead of a local copy: amirror of a real type should name that type where it can, because a local duplicate is one
more thing to drift.
The figures, each re-measured
Measured
cargo build --all-targets --lockedand--all-features,RUSTFLAGS=-D warnings— greencargo doc --no-deps --lockedand--all-features,RUSTDOCFLAGS=-D warnings— green🤖 Generated with Claude Code