refactor(hotblocks): consolidate head/finalized-head into one owner#95
Open
mo4islona wants to merge 1 commit into
Open
refactor(hotblocks): consolidate head/finalized-head into one owner#95mo4islona wants to merge 1 commit into
mo4islona wants to merge 1 commit into
Conversation
Head and finalized-head were held twice in memory — as WriteController fields and as the DatasetController watch channels — kept in sync by hand through WriteCtx.notify_*, so a write that forgot a notify would silently stall wait_for_block. Give the writer the watch senders and route every mutation through set_head/set_finalized_head, which update the field and publish together, after the commit: a write can no longer forget to publish, and a published watermark is always already durable (INV-31/CN-4). The senders live on the controller and are cloned into each rebuilt writer, so seeding moves into WriteController::new and restart re-seed becomes automatic (INV-40/CN-9). The plain head field stays as the writer's committed-state mirror (WP-1) — reading it back from the channel would pin a watch read-lock across the RocksDB transaction in finalize(). WriteCtx dissolves into WriteController, removing the write.write. indirection. New unit tests cover the two properties the conformance matrix flags as untested: a committed transition publishes exactly the durable watermark (INV-30/31) and a rebuilt writer re-seeds from storage (INV-40/CN-9), plus the head-only-progress dedup that keeps finalized waiters from waking. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36e693c to
c2b67e8
Compare
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.
Head and finalized-head were held twice in memory — as WriteController
fields and as the DatasetController watch channels — kept in sync by hand
through WriteCtx.notify_*, so a write that forgot a notify would silently
stall wait_for_block. Give the writer the watch senders and route every
mutation through set_head/set_finalized_head, which update the field and
publish together, after the commit: a write can no longer forget to
publish, and a published watermark is always already durable (INV-31/CN-4).
The senders live on the controller and are cloned into each rebuilt writer,
so seeding moves into WriteController::new and restart re-seed becomes
automatic (INV-40/CN-9). The plain head field stays as the writer's
committed-state mirror (WP-1) — reading it back from the channel would pin a
watch read-lock across the RocksDB transaction in finalize(). WriteCtx
dissolves into WriteController, removing the write.write. indirection.
New unit tests cover the two properties the conformance matrix flags as
untested: a committed transition publishes exactly the durable watermark
(INV-30/31) and a rebuilt writer re-seeds from storage (INV-40/CN-9), plus
the head-only-progress dedup that keeps finalized waiters from waking.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com