Repository navigation
Conversation
…from disk; par-rs 2524277 At line speed the article cache flushes the file being downloaded almost constantly. Its snapshot for live PAR (cache sub-op 1) refused to copy while the file was flush-locked, so every article that finished during a flush of its file was taken as written and par-rs read it back from disk (6790: 437 articles, 335.8 MB of a 3.3 GB set), and its later write kept a copy that no capture ever took. - qfile.rs: the snapshot copies while a flush runs. The segment frees that could race with it (flush discard, sub-op 6; file completion, output op 9/5) now run under the cache content lock the snapshot holds. The 9/5 free was an unlocked race with snapshots before. - File completion hands a data file's cached articles to live PAR before freeing them (streaming_session_articles_completed), as a flush does, but not as readable (the write may still be buffered) and without the back-fill hold the completion keeps itself. - A capture taken as written marks the article, so a later write keeps no stale copy charged to ParBuffer. - Bytes kept before the session past the 64 MB cap: logged once per job. - I/O line: "N copied from the cache during a flush (all jobs)". - par-rs b60bfd1 -> 2524277 (#145): a slice read before its article reaches the file waits instead of counting as damaged; the boundary test now expects the wait and the verify after the write. - Test hook RUSTYGET_TEST_FLUSH_HOLD_MS (logged when set) and scenario liveparflushrace: 1 MB cache, 16 connections, 150 ms flush hold; asserts source_bytes_read 0 and no article read back. On main it reads 35 articles (2.5 MB) back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
xbmc4lyfe
force-pushed
the
live-par-handover
branch
from
November 27, 2026 01:02
bccb220 to
0ce52d8
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why live PAR still read articles back
After #729, a 3.3 GB set on 6790 still had par-rs read 437 articles (335.8 MB) back from disk: "437 article(s) read from their file by par-rs, 0 waited for the cache flush, 0 handed over with the bytes written". prybar's 4 GiB audit saw 0.2-0.3x of every set read back, clean sets included.
Cause: at line speed the article cache flushes the file being downloaded almost all the time (DirectWrite keeps at most a 32 MB burst, and extraction-order download puts every connection on one or two files). The live PAR snapshot of a cached article (
qfile.rscache sub-op 1) refused to copy while its file was flush-locked. So every article that finished while its file was being flushed was "taken as written", and par-rs read it back once its slice completed. Its later write then kept a copy that no capture ever took, charged to ParBuffer until the file completed.It was not the par2 index arriving late (the 6790 session started with the job, 0 bytes kept before the session) and not DirectWrite skipping the hook.
Change
qfile.rs). The copy is allowed while the flush lock is set. The two frees that could race with it now run under the cache content lock the snapshot holds: the flush discard (sub-op 6) and file completion (output op 9/5). The 9/5 free was already an unlocked race with snapshots before this PR. The other frees (ClearArticles, reset, file free) run under the daemon queue lock, which both capture sites hold.articledl.rs,streaming_session_articles_completed). A data file's cached articles written at completion are kept for captures still to come, as a flush does. They are not marked readable, because the write may still be buffered. Completion also skips the back-fill hold, which it keeps itself.staged_duetriggerscomplete_staged_sliceson the next drain.a_committed_range_reported_before_its_write_waits_for_itnow expects the wait, then the verify after the write.RUSTYGET_TEST_FLUSH_HOLD_MS(logged when set; costs one load when unset) and the scenario liveparflushrace: 1 MB cache, 16 connections, 150 ms flush hold. It asserts source_bytes_read 0, no article read back, and at least one copy taken during a flush.Validation
Head: bccb220 (rebased on main e00226f).
(farm run on bccb220 pending)
macOS (m5air): (pending)
Pre-rebase head ea56206d, farm both architectures: cargo_exit=0, daemon_exit=0, 434/434 on x86_64 and on arm64.
Review
Clean-room review of f1be381..ea56206d: G2G, with 4 non-blocking findings, all fixed in this head:
Deployment / measurement
Deploy through the 6790 queue and measure source reads before and after on a 3+ GB set: (pending)
🤖 Generated with Claude Code
https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM