Repository navigation
fix(fileservice): bound background downloads, keep cost estimates and read share honest - #32345
Conversation
… read share honest - A background download keeps its reader's deadline and ends when the disk cache closes. - A read that captured its bytes does not fail when its download fails later, also when no background slot was free. - The download rate is fed only by downloads from object storage; content already in memory is cached without tracking it as a download. - Range-read cost is timed only for reads the file service drains to the end. - Bytes read from a downloading object count toward its cached file's read share. - The LRU disk cache inserts an item larger than its capacity as oldest, and does not evict an item before its insert notification returns. - Design v3 records these contracts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 0b6dd9b1c488c6bd966d8e1881da29ce0dda4fd0
Assessment: request_changes
The focused reuse of existing owners is appropriate, but two accounting defects remain: content fills lose object-size observations, and download reads can lose read-share credit during publication.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
-
P2
pkg/fileservice/disk_cache.go:1433: Populate a fresh disk cache through S3FS.write or the full-object content-read path, which now uses setFileContent.
Impact: wholeObjectFits retains its 128MiB default or a stale maximum, incorrectly keeping narrow reads in range mode or reporting room for objects that do not fit.
Evidence: trackDownload=false skips creating objectDownload at line 901, which also suppresses noteWholeFile(n) at lines 943–945. Previously these callers recorded the whole-file size. For example, an 8KiB content fill in a fresh 1MiB cache leaves the fit calculation using 128MiB. Preserve whole-file size observations independently of throughput sampling and cover content fills in the fit-policy tests. -
P2
pkg/fileservice/disk_cache_download.go:198: A download publishes while an acquired reader remains inside IOEntry.readFrom, for example blocked in WriterForRead.
Impact: Successful download reads receive no preload read-share credit, leaving the claimed accounting fix incomplete and allowing false thrashing signals.
Evidence: finishDownload samples served only once, without waiting for acquired readers. served.Add occurs after readFrom returns at line 248; later release never transfers that increment. Publication-time eviction can also consume/delete the preload record before this transfer. Reconcile counts across publication, active readers and eviction; add overlap and immediate-eviction regression cases.
Validation:
-
Reviewed all nine changed files, relevant owners/consumers, closing issue and complete supplied discussion.
-
Preflight and frozen-source/Go formatting-parser audits passed; receipts and logs are matched in validation-ledger.json.
-
Frozen current-head CI reports successful build, UT, SCA, coverage and proxy/pessimistic multi-CN BVT.
-
Author reports focused race repetitions and affected-package passes; these do not cover the identified boundaries.
Limitations:
-
Local targeted race testing timed out downloading Go 1.27.1 before compilation; no product tests ran locally.
-
Regression overlay probes were retained but not executed. Findings are established by source traces; raw author/CI execution logs were not supplied.
…s at publication - A whole-object fill from memory is tracked as a download again, so readers share it, Update skips its ranges and the room check records its size; only downloads from object storage feed the download rate. - Bytes read from a download are counted before the read and credited to the file when it is published, so a file evicted at once, or a read still running at publication, keeps them. - The LRU disk cache neither evicts an item nor counts it toward eviction until its insert notification returns, so an oversized item no longer empties the cache while it is inserted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 1e0a2ecc1aeae97919a907d9383719fafd6feb9e
Assessment: request_changes
The existing owners are reused appropriately, and both prior accounting findings are resolved at their cited boundaries. Two advertised fixes remain incomplete: initiating streaming reads lack read-share credit, and concurrent hits can defeat oversized-first eviction. These are remaining preexisting cases, not new regressions.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
-
P2
pkg/fileservice/disk_cache_download.go:266: A cold S3FS.Read starts a whole-object streaming download and receives its bytes through fullObjectDiskCacheReader.capture, without a follower entering DiskCache.Read.
Impact: The initiating read bypasses this accounting call, leaving its read-share contribution at zero. Subsequent evictions can classify useful objects as unread and switch their group to range reads. Include initiating captures in the publication-safe accounting and add starter-path coverage.
Evidence: s3_fs.go:1564 calls capture; readRange at :1664-1672 copies bytes directly without calling serve or preloads.read. disk_cache.go:203-205 transfers only takeServed. The source-extracted race probe captured 4096 bytes but transferred 0; its follower control passed (host-download-probe-race.log). -
P2
pkg/fileservice/lrucache/lru.go:139: A concurrent Get accesses an oversized item while its Set is waiting for postSet to finish.
Impact: Get promotes the oversized item, so eviction removes older warm entries before removing it. Preserve oversized eviction priority across concurrent hits and cover this overlap.
Evidence: set releases the shard lock during postSet (:159-162), while Get unconditionally replaces the stamp and moves the item to the front (:181-186). With capacity 100, two warm entries of 40 and an oversized entry of 150, the deterministic race probe loses both warm entries and finishes at Used()==0; the no-hit control retains 80 (host-probes-race.log). Startup file admission permits this reader overlap.
Validation:
-
Reviewed all nine changed files, four discussion entries, the linked issue and both comments, and affected owners/consumers. Saved review-plan.md, source-proof.md and complete discussion-assessment.json.
-
Host/internal race probes demonstrated both findings with passing adjacent controls. Exact source copies/extractions and input hashes are retained in host-probe-manifest.json.
-
Isolation preflight, frozen-source/diff/gofmt/overlay-syntax and probe-provenance audits passed. Eight check receipts are reconciled with retained logs and probe versions in validation-evidence.json.
-
The supplied exact-head snapshot reports successful build, UT, SCA, coverage and active multi-CN BVT. Author-reported focused race and package results were assessed separately.
-
Repository testing stopped before compilation because compatible libmo.so was unavailable. An initial host extraction omitted a shared constant; the corrected missing component was rerun. These setup failures are excluded from product-test results.
Limitations:
-
Host probes use Go 1.26.6 and extracted source, not the repository Go 1.27.1/native build. No local full file-service or S3 service execution is claimed.
-
local_validation is empty, and raw author/CI logs were not supplied. A repository-fixture regression overlay is retained but unexecuted.
…zed items oldest - The read that starts a whole-object download counts the bytes it captures toward the file's read share, as other readers of the download do, so an object read only by its starter is not taken as unread. - A use of an item larger than the LRU capacity does not make it newer, so a read while it is inserted no longer evicts warm items before it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Addressed the finding of the review of
Test: Validation:
|
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 2cb74353326543ee4cba549e41797892c8c450c9
Assessment: approve
The fixes reuse existing cache owners and resolve all prior findings. No actionable PR defects remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Reviewed all nine changed paths, affected consumers, complete discussion and linked issue context; source unchanged.
-
Preflight, source/format audits, LRU normal/race suites and full fileservice race suite passed.
-
All 38 focused race checks passed 43–100 repetitions each.
-
Baseline normal suite and deterministic deadline-fallback controls on both revisions passed. All 55 check receipts are reconciled in validation-ledger.json.
Limitations:
-
Candidate normal fileservice suite failed unchanged TestDesignDownloadFetchedOnce after a test-installed one-second deadline caused an allowed second range request. Controls confirmed this behavior on both revisions; the candidate normal suite is not recorded as passing.
-
Raw author/CI logs were unavailable. No additional SQL, real remote-storage or performance campaign was run.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #32274
What this PR does / why we need it:
Follow-up to #32275. Review of the merged code found seven defects in the object-download layer and the LRU disk cache. Each fix comes with a regression test that fails without it. The design (docs/design/20261106-fileservice-cache-ownership.md) moves to v3 to record the contracts these fixes add.
DiskCache.Close, so a stalled stream held its background slot forever.A second commit (
1e0a2ecc1a) answers the review of the first and a self-review of it:The prefetch design also corrects one sentence: a full LRU disk cache evicts only to make room, so the thrash signal turns off after the cache grows or files are deleted, not when files "age out".
Validation
-race.pkg/fileservice/...passes in a normal run, andfileservice,lrucacheands3fifoeach pass one run under-race.🤖 Generated with Claude Code