Skip to content

cache: rescan_origins silently drops hashes whose origin size probe fails #1807

Closed

Description

@thiras

Surfaced by the review of #1806 (issue #1561).

CacheEngine::rescan_origins rebuilds the origin-held index wholesale and swaps it atomically. A candidate whose size probe fails is dropped on the same branch as one the origin genuinely does not hold — crates/cache/src/engine.rs:

if let Ok(Some(size)) = self.origin_size(hash).await {
    held.insert(hash, size);
}

Err(..) and Ok(None) collapse into "origin doesn't have it → skip", with no log and no counter. The only surviving signal is the per-origin enumerate warn a few lines above, which covers a different failure.

Why it matters

For an S3/R2/HTTP origin, origin_size is a live HeadObject/HEAD. A transient 5xx or a throttle window during a rescan silently evicts those hashes from the announce set until the next successful rescan.

Everything downstream then reports success. origin_held_hashes() returns the truncated set; dht::publish::holder_snapshot folds it in with store_error: None, i.e. a fully healthy snapshot. On the boot path that shrunken set becomes the cold-start seed and cold_start_count reads plausibly low; on the sweep path reseeded under-reports and decdn_dht_republish_seed_store_walk_failures_total stays at zero.

Net effect: an origin-only node that hits a throttled HeadObject window during its boot rescan advertises a fraction of its content for a full rescan interval, with every signal green.

Suggested fix

Distinguish Err from Ok(None):

  • Ok(None) — the origin genuinely does not hold it. Skip, as today.
  • Err(..) — a probe fault. Count it (decdn_cache_origin_probe_failures_total or similar), and consider carrying the previous index entry forward rather than dropping it, so a transient fault does not shrink the announce set.

Exposing the drop count would also let HolderSnapshot carry it alongside store_error, which is what would actually deliver the "both seed paths cannot drift apart" property #1806 aims for.

Activity

  1. added
    prio:medium
    rust
    on Aug 24, 2026
  2. self-assigned this
    on Aug 24, 2026
  3. moved this from Backlog to In progress in deCDNon Aug 24, 2026
  4. moved this from In progress to Done in deCDNon Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

prio:mediumrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions