Skip to content

cache: reactive local-origin pull-through is coupled to node_to_node_pull_through_enabled #1116

Closed

Description

@alpergundogdu

Summary

Reactive origin pull-through — including serving a blob from the node's OWN configured cache.origin (fs/http/s3) — is gated entirely behind cache.node_to_node_pull_through_enabled. A cache-only origin operator that does not want to participate in node→node (paid) pulls therefore cannot reactively serve its own origin at all: a cache miss for a blob present only in its local origin is refused as NotFound.

This surfaced while fixing #1115. That fix made the node→node window branch consult local origins first (via CacheEngine::populate_local, crates/node/src/handlers/client.rs:1115), but only within the window branch — which is still only wired when the node→node flag is on. The broader coupling was intentionally left as this follow-up.

Evidence (file/line)

  • crates/node/src/runtime/mod.rs:1086 — if cfg.cache.node_to_node_pull_through_enabled { wraps both reactive attachments:
    • :1089 client_handler.attach_pull_through(outer_deadline) (the buffered populate path), and
    • :1103 client_handler.attach_window_pull_through(..) (the window path).
  • crates/node/src/handlers/client.rs:700 / :1157 — the buffered serve-miss path only runs when self.pull_through.get() is Some, i.e. only after attach_pull_through.
  • crates/node/src/handlers/client.rs:1102 — the window path only runs when self.pull_through_origin.get() is Some, i.e. only after attach_window_pull_through.
  • Net: with node_to_node_pull_through_enabled = false, the Ok(false) (cache-miss) arm has no reactive origin path and falls straight to ServeRejectReason::CacheMiss, even for a blob the operator holds in its own fs/http/s3 origin.

Why this matters

An origin operator's core function is to serve its own content. Coupling that to a node→node participation flag is surprising: an operator who sets [cache.origin] but leaves node→node off gets silent NotFounds for content it actually has. Local-origin reads front no external USDC (unlike a node→node pull), so the exposure rationale that motivates gating node→node does not apply to them (S3 egress cost is the one nuance — see below).

Proposed direction

Decouple reactive local-origin populate (CacheEngine::populate_local, non-Peer origins) from node_to_node_pull_through_enabled:

  • Run try_local_populate on the cache-miss path whenever the request is pull_authorized (proven channel ownership), independent of the node→node flag — the node→node window/buffered paths stay gated on the flag as today.
  • Keep the pull_authorized gate: an S3 origin has egress cost, so a reactive local pull should still require a funded, owned channel (the following delivery is paid per-voucher). This matches the existing gating on the buffered path.
  • Consider whether this wants its own opt-in (cache.reactive_origin_pull_through, default-on when [cache.origin] is set) vs. being implicit — a small design decision worth recording.

Relates to #1115.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:featurerust

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions