Repository navigation
Description
Problem
node_origin::resume::pull_blob accumulates the whole blob into LoopState.buf: Vec<u8> and hands it back as OriginFetch::found_one_shot(bytes). It is the last ingest path holding a whole blob in RAM — every other miss source streams to disk at O(chunk-group) through admit_bao_stream (#1607) and the BlobSource unification (#1608).
That asymmetry has a direct cost. #1678 removed max_blob_size_mb and made cache.cache_size_mb the only ceiling, because with memory off the table a node should serve any blob its disk holds. This tier could not follow: a 10 GiB disk budget is not 10 GiB of RSS to spend on one pull. So it kept a ceiling in its own quantity — cache.origin_retry.buffered_max_bytes, 4 MiB by default.
Consequence today: the buffered node-to-node fallback tier refuses blobs over 4 MiB, and they must arrive through the streaming window tier instead.
Intent
Drive this loop through BlobSource + NodeAdmitStore like the gap-driven driver does, so the buffer disappears and with it the ceiling. Then delete BufferedTierTooLarge and NodeOriginConfig.buffered_tier_max_bytes, and drop PullVerdict::OversizeClaim and decdn_node_pull_too_large_total with them.
What makes it non-trivial
The loop is not just a sink swap — resume.rs's module doc lists why it was not pushed into client-pull in the first place, and each reason is work here:
- Resumable rewind. The retry path rewinds with
Vec::truncateback to the paid frontier (content_paid_frontier). Against a ranged store the equivalent is re-deriving missing ranges, not truncating. - Reactive mid-pull top-up (Node reactive mid-pull top-up (node-to-node buyer leg) #1530):
MAX_REACTIVE_TOPUPS, the settle wait,fund(). The gap-driven driver has its own funder seam (DriveConfig,Funder::max_topups) — reconcile rather than duplicate. - Reputation + settle bookkeeping.
pull_from_candidatescores the provider and holdsSettleOnDrop; the verdict ladder (pull_verdict) must keep classifying correctly. Origin::fetchowes its caller one contiguousBytes. The cache engine'sOrigintrait shape is what forces the buffer. Either that call site reads back from the store after admission, orNodeOriginstops implementingOriginfor this path.
Payoff
- No O(blob) RAM anywhere in ingest — the end state feat(node): unify miss sources behind BlobSource; remove max_blob_size_mb #1608 named.
- The 4 MiB buffered-tier ceiling goes away; every tier serves what the disk budget allows.
- One fewer bespoke retry loop.
History
Split out of #1678. #1608's BlobSource unification covered BackendSource and PeerSource; this loop predates it and was left on the old shape.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
refactor: drop the cache instrumentation from #1678 — out of scope
alpergundogdu commentedon Aug 14, 2026
Staying open. #1685/#1686 default
max_blob_size_mbtocache_size_mbbut do not touch this loop:resume::pull_blobstill buffers the whole blob intoLoopState.bufbounded bymax_blob_size_bytes. So the new default raises this tier's worst-case RAM to the full disk budget — this port is now the load-bearing fix for that exposure, not just a tidy-up.feat(config): default max_blob_size_mb to cache_size_mb, keep the knob (
refactor(node): stream node-to-node pull to disk, drop the last O(blo…