Repository navigation
test(cache): eviction composes with N coalesced serve-leg readers (B3, #1656) - #1665
Conversation
…#1656) B3 multi-observer coalescing (#1656, PR #1660) deferred a test for the decision-5 claim that eviction under in-flight serve legs stays logical and composes with reader-pinning. Add `evict_mid_serve_lets_coalesced_readers_finish_then_reclaims`: two in-flight `export_bao_range_stream` readers over one tagged partial, evicted mid-serve, gated on a control blob's GC reclaim; both readers must still drain byte-for-byte to the pre-evict wire, then the partial is reclaimed. The invariant holds — no bug — but the mechanism is subtler than the earlier mental model of "GC reclaims only after the last reader": the serve leg takes no TempTag/own GC root, so the partial is protected solely by the admit-path `decdn-partial-{hash}` named tag. Evict drops it and the next GC sweep deletes the blob, flipping `blobs().status()` to `NotFound` immediately. In-flight readers still complete because each holds its own live iroh `export_bao` handle and the bytes stay reachable through the open fd until it drops (Unix unlink-while-open; disk space frees on last close). Reader-pinning is therefore unchanged by coalescing: N readers survive evict + GC exactly as one does. Test-only. The full two-observer FillSession serve harness stays deferred; the cache-level two-reader test is the honest reduction of it. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Coverage reportTotal: 80.56% (was 80.57%, ▼ 0.01%) — 62916/78096 lines
History
|
There was a problem hiding this comment.
Pull request overview
This PR adds a cache-level regression test in decdn-cache to validate that operator eviction (dropping the B0 partial tag and allowing GC to sweep) composes correctly with multiple concurrent serve-leg readers created via export_bao_range_stream.
Changes:
- Add
evict_mid_serve_lets_coalesced_readers_finish_then_reclaimsto prove two in-flight export readers can fully drain byte-for-byte afterevict+ a GC sweep. - Add small async test helpers (
drain_serve_leg,wait_reclaimed) to make the test robust against CI timing variance.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… test (review) Address PR #1665 review (Copilot): - Gate the drain on the TARGET hash flipping to `NotFound` while both serve legs are still held, instead of on a separate control blob. This turns the documented subtlety — the GC sweep deletes the untagged blob and flips its logical status without waiting for in-flight readers — into a direct assertion, and still proves a sweep ran after the tag drop. Drops the now -unneeded control partial. - Remove the redundant post-drain `wait_reclaimed` (the store already reported `NotFound` while the handles were open) and its overstated comment (`BlobStatus::NotFound` is a logical view, not a filesystem-usage check). - Fix a doc line-break that rendered "already -pulled"; state the summary in terms of the logical removal rather than disk reclaim. Test-only; still passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
What
Adds
evict_mid_serve_lets_coalesced_readers_finish_then_reclaimstocrates/cache/src/engine.rs, the deferred test from B3 multi-observer coalescing (#1656, PR #1660, decision 5). It proves eviction composes with N coalesced serve legs at the cache level:decdn-partial-{hash}named tag).export_bao_range_streamreaders over it (the serve-leg readers N coalesced observers reduce to) and pull the first frame of each.Why / finding
The invariant holds — no bug — but the earlier mental model ("GC reclaims only after the last reader") is imprecise, and the test pins the real mechanism:
TempTag/ own GC root. The partial is protected solely by the admit-path named tag.evictdrops that tag, so the next GC sweep deletes the blob andblobs().status()flips toNotFoundimmediately — not deferred to the last reader.export_baohandle; the bytes stay reachable through the open fd until it drops (Unix unlink-while-open — disk space is what frees on last close).Scope / notes for the reviewer
FillSessionserve harness stays deferred (too heavy for a unit test); the cache-level two-reader test is the honest reduction of it — theFillSessionobserver leases are coordination bookkeeping, while the export handles are what actually pin the bytes.cargo clippy -p decdn-cache --all-targets -- -D warnings,cargo nextest run -p decdn-cache --lib, andcargo fmt -p decdn-cache -- --checkall pass; the workspace pre-commit hook (fmt + clippy) also passed on commit.🤖 Generated with Claude Code