Skip to content

docs(rollout): correct add() contract to async visibility - #188

Merged
beinan merged 1 commit into
mainfrom
fix/rollout-add-doc-contract
Jul 25, 2026
Merged

docs(rollout): correct add() contract to async visibility#188
beinan merged 1 commit into
mainfrom
fix/rollout-add-doc-contract

Conversation

@beinan

@beinan beinan commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes #183.

Problem

#181 moved the seal off the append path: add now performs only a durable put, and force_seal_active + wait_for_flush_drain live in flush, driven by the server's periodic flush sweeper (default 30s).

The doc comment on add was not updated. It still claimed:

Each append is sealed and its flushed generation committed to the shard manifest before returning, so the rows are immediately visible to reads on any instance

and still described the per-append work as put → force_seal_active → wait_for_flush_drain.

This directly contradicts the inline comment ~10 lines below it, which correctly says read-after-write is asynchronous. As a public rustdoc contract it tells every downstream caller they have read-your-write when in the default configuration they may wait up to 30 seconds.

Change

Docs only. The rewritten comment states:

  • add is durable on return — put waits for the WAL entry to reach object storage
  • add is not visible on return; a row becomes readable only once its memtable is sealed by flush (or close, or the merge path's internal close)
  • the gap is bounded by ROLLOUT_FLUSH_INTERVAL_SECS; callers needing immediate visibility should add().await then flush().await
  • why the decoupling exists (per-append seal serialized concurrent appends)
  • a forward pointer that RolloutObservation::row_count does not count durable-but-unflushed rows

Also fixes a stale intra-doc link to ensure_write_writer, which no longer exists (now resident_writer).

Verification

No behavior change. The documented contract is already asserted by the existing add_is_durable_but_not_visible_until_flush test added in #181 — I started to add an equivalent test before finding it, and dropped mine as redundant.

cargo test -p lance-context-core --lib → 161 passed, 0 failed.

🤖 Generated with Claude Code

`add` stopped sealing on the append path in #181 — it now performs only a
durable `put`, with `force_seal_active` + `wait_for_flush_drain` moved to
`flush` and driven by the server's periodic flush sweeper. The doc comment
was not updated and still claimed rows are "immediately visible to reads on
any instance" and described the old three-step per-append work, directly
contradicting the inline comment a few lines below it.

Rewrite the contract to state what the code does: durable on return, not
visible on return, with the gap bounded by ROLLOUT_FLUSH_INTERVAL_SECS and
an explicit pointer to `flush` for callers needing read-your-write. Also
fix a stale link to the removed `ensure_write_writer` and note the
`observe()` undercount that follows from the same asynchrony.

Docs only; no behavior change. The contract is already covered by the
existing `add_is_durable_but_not_visible_until_flush` test.

Closes #183

Co-Authored-By: Claude <noreply@anthropic.com>
@beinan
beinan merged commit 9ea8965 into main Jul 25, 2026
9 checks passed
@beinan
beinan deleted the fix/rollout-add-doc-contract branch July 25, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(rollout): RolloutStore::add doc comment still promises synchronous visibility

1 participant