Repository navigation
feat(client-pull): Streamer on the multi-source core with candidate failover (#1848) - #2111
Merged
alpergundogdu merged 1 commit intoSep 22, 2026
Conversation
…ailover (#1848) Phase 2: replace the Streamer's single-source `drive` with the consumption-paced `multi_source_fetch`, so a stream fetches its front across a small, bounded set of provider candidates and fails over between them. - Streamer::new now takes a Vec<StreamCandidate> (source + paying ctx/ledger per provider) instead of one source. It drives multi_source_fetch with a WindowPacer(read_ahead) + the consumer cursor as the downstream frontier (ConsumptionPacing), capped to PullConfig::streamer_lane_cap (new tunable, default 2). VerifiedReader is unchanged. - A candidate that faults mid-stream is dropped and its remainder reassigned to another (shared-pool free failover, #1174), resuming from the store's verified frontier so no delivered byte is re-pulled or re-paid. - The no-verified-progress watchdog is off (unit_deadline ZERO): a paced stream parks lanes on the consumer cursor, which is not a stall — a genuinely silent source trips its own per-stream throughput floor instead. multi_source_fetch does not finalize, so the stream leaves the store at .partial (a stream is not kept as a file); the reader reads its checkpointed present frontier as before. Tests: a mid-stream candidate fault fails over and the drained stream is BLAKE3-identical (faulty candidate delivered a prefix first); the existing drain / tampered / cache / bounded tests all still pass on the multi-source core. Stacked on the Phase 1 scheduler change. Follow-up (Phase 3): Downloader reshaped onto this core as a wrapper (uncapped fan-out + dedup pre-seed). Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The Streamer cache-miss path should validate empty candidate sets and a zero lane cap up front to avoid deferred “first read” failures and surprising tunable behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR continues the client-pull “core unification” work by moving the Streamer off the single-source drive path and onto the consumption-paced multi_source_fetch scheduler, enabling bounded parallelism and mid-stream candidate failover while keeping VerifiedReader semantics (only verified bytes are readable).
Changes:
- Refactors
Streamerto accept aVec<StreamCandidate>(per-providersource+(ctx, ledger)) and to drivemulti_source_fetchwithConsumptionPacingand aWindowPacer(read_ahead). - Adds
PullConfig::streamer_lane_cap(default 2) to cap Streamer front fan-out and exports the new default constant. - Adds a new unit test that injects a mid-stream candidate fault and asserts failover still yields byte-identical output.
| File | Description |
|---|---|
| crates/client-pull/src/streamer.rs | Switches Streamer over to multi-source fetching with consumption pacing, lane cap, and failover; adds a failover test. |
| crates/client-pull/src/lib.rs | Re-exports StreamCandidate and DEFAULT_STREAMER_LANE_CAP for downstream use. |
| crates/client-pull/src/config.rs | Adds streamer_lane_cap tunable and its default constant to PullConfig. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+173
to
+182
| let ms = MultiSourceConfig { | ||
| // Small, bounded front parallelism: a paced stream wants a little | ||
| // same-region fan-out and free failover, not a full download's striping. | ||
| max_sources: lane_cap.max(1), | ||
| // The Streamer parks lanes on the consumer cursor — a full read-ahead | ||
| // window is not a stall — so the no-verified-progress watchdog is off. A | ||
| // genuinely silent source instead trips its own per-stream throughput | ||
| // floor mid-read and is reassigned that way. | ||
| unit_deadline: Duration::ZERO, | ||
| }; |
Base automatically changed from
claude/multi-source-consumption-pacing
to
claude/trusting-raman-1b3304
September 22, 2026 12:44
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 #2110 (which is stacked on #2108). Phase 2 of the Downloader/Streamer core-unification.
What & why
Replaces the
Streamer's single-sourcedrivewith the consumption-pacedmulti_source_fetch(from #2110), so a stream fetches its front across a small, bounded set of provider candidates and fails over between them — one resilience/verify path, the same core the Downloader will use.Streamer::newnow takes aVec<StreamCandidate>(source + payingctx/ledgerper provider) instead of one source. It drivesmulti_source_fetchwith aWindowPacer(read_ahead)+ the consumer cursor as the downstream frontier (ConsumptionPacing), capped toPullConfig::streamer_lane_cap(new tunable, default 2).VerifiedReaderis unchanged.unit_deadline: ZERO): a paced stream parks lanes on the consumer cursor, which is not a stall — a genuinely silent source trips its own per-stream throughput floor instead.multi_source_fetchdoesn't finalize, so the stream leaves the store at.partial(a stream isn't kept as a file); the reader reads its checkpointed present frontier as before.Tests
client-pullsuite: 319/319.Note on fan-out under a small window (per the design spec)
spread_segmentsseeds at 64 MiB-block granularity, so for a large blob with two whole-blob holders they split front/back and under a small window the back lane parks — the front is single-lane + failover + a pipelined second lane. Blobs ≤64 MiB get true 2-lane front fan-out. Concurrent front fan-out on a large blob needs a steal-preference-under-window tweak; deferred (single-lane-front + failover is a fine first cut, and the lane cap is just a number when we want to revisit).Follow-up
Downloaderreshaped onto this core as a wrapper (uncapped fan-out + dedup pre-seed).Design spec:
~/Workspace/decdn/specs/2026-09-22-multi-source-core-and-face-unification-design.md.🤖 Generated with Claude Code