Repository navigation
fix(graph-db): release small staging generations in one commit - #4884
Merged
Merged
Conversation
Staging-row release planned relations and entities as separate pages, so even a three-row generation paid two fsync-backed commits. One bounded page now admits relations first and then entities under a single shared mutation-count and live-byte budget. Entities join a page only after every remaining relation is admitted, which keeps the relations-before-entities order, the per-page cancellation boundary, and the idempotent retry of a partially released generation. Both fsync-backed guarantees and the typed WAL failure handling are unchanged. Co-Authored-By: Claude Opus 5.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.
Summary
Staging-row release planned relations and entities as separate pages, so every release paid at least two fsync-backed commits, even for three rows. This PR replaces the two per-kind page helpers with one bounded planner (
projection_deletion_page_checked):DeleteRelationbeforeDeleteEntity, so relations are still applied first inside the one transaction.GenerationRetirementPageKindand the two per-kind helpers are deleted; the existing single-pass scan is reused with a shared budget.Unchanged: grafeo's commit-record fsync, our follow-up
sync_walfsync (the only fsync covering grafeo'sEpochAdvancerecord, and the only place a WAL failure becomesDurabilityUncertain, since grafeo logs WAL write errors and continues), and the typed WAL failure handling.Why
CI run 43308573947 on #4871 failed
verified_generation_contract::staging_footprint::release_sweep_retries_idle_sealed_reader_hibernationatstaging_footprint.rs:927(Err(Timeout): the release didn't finish within 100ms while a sealed reader was parked).Per-phase timing on macOS showed no lock blocking: every snapshot-gate and database-guard wait was 41ns–6µs. Nearly all the time was in row deletion's two durable commits. Each paid a grafeo commit with its fsync (~5–8ms) plus our
sync_walfsync (~4–9ms).Measured (macOS, this test alone, 5 runs each, staging engine already open)
e845a0653c)The Linux CI causal link is not proven. The failure didn't reproduce locally (8/8 passes on master), and no CI timings exist. These are Mac measurements of avoidable serialized fsync work on the path the test times, not a reproduction of the CI timeout. The 100ms assertion is unchanged.
Tests
New unit tests in
generation_runtime::tests:small_mixed_generation_releases_its_rows_in_one_durable_commit: 2 entities and 1 relation release with the projection's real commitsequenceadvancing by exactly 1, and a physical reopen observes the same commit with no rows. Fails on master (sequence 5, expected 4).release_page_fills_its_shared_budget_with_entities_after_relations: with 1 relation and 4,106 entities, the first page removes the relation plus exactly 4,095 entities.release_page_admits_entities_only_after_every_relation: with 4,097 relations, the first page leaves every entity in place. After a physical reopen, the next page releases the last relation and the entities together.Verification (Bazel; every name-filtered run went through
scripts/require-exact-test.shand reported a nonzero count)://crates/tracedecay-graph-db:unit_testgeneration_runtime::tests: 27 passed (includes the existing partial-release replay, read-once, cancellation and reopen tests)//crates/tracedecay-graph-db:unit_teststate::tests: 6 passed//crates/tracedecay-graph-db:graph_db_suite:release_sweep_retries_idle_sealed_reader_hibernation: 1 passedverified_generation_contract::staging_footprint: 15 passedreplay: 11 passedretire: 15 passedrustfmt_check_2024andbazel build --config=clippy //crates/tracedecay-graph-db/...(-Dwarnings): pass🤖 Generated with Claude Code