Skip to content

cache: avoid repeated multi-level capability checks - #2910

Open
codeandsolder wants to merge 2 commits into
mozilla:mainfrom
codeandsolder:upstream-pr/multilevel-cache-mode-once
Open

codeandsolder wants to merge 2 commits into
mozilla:mainfrom
codeandsolder:upstream-pr/multilevel-cache-mode-once

Conversation

@codeandsolder

Copy link
Copy Markdown
Contributor

Fixes #2818.

Summary

  • cache each multi-level backend's effective CacheMode in an async OnceCell
  • reuse the cached mode on writes instead of calling Storage::check() per write
  • skip levels known to be read-only while preserving the configured write-error policy
  • preserve underlying write-error sources when adding level context

A normal server startup still performs the existing storage capability check before serving. Required probe failures keep their existing startup-failure behavior; tolerated failures remain best-effort.

Validation

  • full Rust 1.99 library suite: 577 passed, 0 failed
  • focused Rust 1.99 regressions verify a backend mode is checked once across multiple writes and tolerated check failures are not re-probed per write
  • cargo fmt and git diff --check
  • Mozilla Rust 1.91 exact CI Clippy gate passes

@codecov-commenter

codecov-commenter commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.23077% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.87%. Comparing base (edeffeb) to head (3c1c8a4).

Files with missing lines Patch % Lines
src/cache/multilevel.rs 98.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2910      +/-   ##
==========================================
+ Coverage   78.82%   78.87%   +0.05%     
==========================================
  Files          75       75              
  Lines       45394    45512     +118     
==========================================
+ Hits        35781    35899     +118     
  Misses       9613     9613              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codeandsolder-git-wrangler
codeandsolder-git-wrangler Bot force-pushed the upstream-pr/multilevel-cache-mode-once branch 3 times, most recently from d3b2f5d to 669e5a8 Compare October 18, 2026 07:19
Comment thread src/cache/multilevel.rs Resolved
Comment thread src/cache/multilevel.rs Resolved
Comment thread src/cache/multilevel.rs Resolved
Comment thread src/cache/multilevel.rs Resolved
Comment thread src/cache/multilevel_test.rs Resolved
@codeandsolder-git-wrangler
codeandsolder-git-wrangler Bot force-pushed the upstream-pr/multilevel-cache-mode-once branch from 669e5a8 to 581be09 Compare October 18, 2026 09:10
Comment thread src/cache/multilevel.rs Resolved
@codeandsolder-git-wrangler
codeandsolder-git-wrangler Bot force-pushed the upstream-pr/multilevel-cache-mode-once branch from 581be09 to 4b3f91f Compare October 18, 2026 20:11
Comment thread src/cache/multilevel.rs Resolved
Comment thread src/cache/multilevel.rs Resolved
Comment thread src/cache/multilevel.rs Resolved
Comment thread src/cache/multilevel_test.rs Resolved
@codeandsolder-git-wrangler
codeandsolder-git-wrangler Bot force-pushed the upstream-pr/multilevel-cache-mode-once branch from a7ce19a to becbbba Compare October 20, 2026 01:26
@codeandsolder-git-wrangler
codeandsolder-git-wrangler Bot force-pushed the upstream-pr/multilevel-cache-mode-once branch from becbbba to 88ee7ab Compare October 28, 2026 06:52
@sylvestre
sylvestre force-pushed the upstream-pr/multilevel-cache-mode-once branch from 88ee7ab to 3c1c8a4 Compare November 10, 2026 16:00
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.

Multi-level calls check() on every write, adding a remote read+write per compilation

3 participants