Repository navigation
Simplify the cache-provider fill-coordination API - #116092
Conversation
Reshape the CacheWriter / ICacheProvider interface so the read executor drives fills through a smaller, clearer contract. No behavior change; the experimental ReaderExecutor read path is the only consumer. - CacheWriter::committed returns the end of the committed prefix as a size_t instead of an IntervalSet. A segment fills append-only, so what is committed is always one contiguous prefix; a scalar frontier captures it. The disk writer reads the segment's live frontier directly, dropping its committed_ranges / committed_mutex bookkeeping. - claimLeadRole drops its ByteRange argument and returns just the Claim (the Lead struct is removed). The caller reads the committed prefix via committed and derives the tail itself. - Add CacheWriter::fillsWholeSegment, the writer-level mirror of the existing ICacheProvider::fillsWholeSegment, so a fill target can report whether it stores each segment whole or appends incrementally. - Remove ICacheProvider::populatesOnMiss. A tier that does not populate now emits a writer-less miss from resolve instead of carrying a runtime flag; the executor already treats a writer-less miss as read-from-source-only.
|
Workflow [PR], commit [9fb1f87] Summary: ❌
AI ReviewSummaryThis PR simplifies the Final Verdict
LLVM Coverage ReportMeasured on commit 9fb1f87.
Changed lines: Changed C/C++ lines covered: 145/172 (84.30%) · Uncovered code |
Defer the whole-segment vs incremental detail to the provider-level ICacheProvider::fillsWholeSegment doc it mirrors.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units48 translation units recompiled, 351 s compile time in total, 48 of them have a recent master baseline. |
committed() is always in [range().offset, range().end()]: range().offset when nothing is committed, range().end() when complete. Make the invariant explicit in the contract.
…und it `Claim` promised exclusivity that only the filesystem-cache tier provides. The page cache elects no downloader: two readers of the same absent block both get a held role, both fetch, and `PageCache::getOrSet` keeps the first write. Naming that a claim invited the reader to assume otherwise. The type answers one question - should this reader fetch the uncommitted part and write it - and on a coordinating tier additionally carries the downloader role it won. The docs now lead with that, and state that a non-coordinating tier holds the role trivially and releases nothing. `claimLeadRole` becomes `takeFillRole`, `makeClaim` becomes `makeFillRole`. `committed()` is contractually within `[range().offset, range().end()]`, and both implementations bound it - the page cache returns one end or the other, the disk cache clamps - so `complete()` compared with `>=` against a value that cannot overshoot. It now compares with `==`, stating the invariant instead of hedging against it. Two locals in `DiskCacheProvider` said less than they could. `frontier` becomes `seg_committed_file_end`, naming both the helper's output and the space it is in; `segmentCommittedEnd` is not the segment's write offset, since it reports `range().right + 1` for a `DOWNLOADED` segment. `seg_file_hi` becomes `seg_file_end`, and the `seg_file_lo` / `seg_file_hi` pair in `waitAndRead` becomes `seg_file_begin` / `seg_file_end`, so an exclusive bound is called `end` throughout, as `ByteRange::end` already is. No behaviour change. Addresses review comments from kssenii on #116092.
Mirrors #116092, whose API changes this branch carries its own copy of. `Claim` promised exclusivity that only the filesystem-cache tier provides: the page cache elects no downloader, so two readers of the same absent block both get a held role, both fetch, and `PageCache::getOrSet` keeps the first write. The type answers one question - should this reader fetch the uncommitted part and write it - and on a coordinating tier additionally carries the downloader role it won. `claimLeadRole` becomes `takeFillRole`, `makeClaim` becomes `makeFillRole`. `complete()` compares with `==` rather than `>=`, since `committed()` is bounded by `range().end()` in both implementations. Two locals in `DiskCacheProvider` gain names that say the space they are in: `seg_committed_file_end`, and `seg_file_begin` / `seg_file_end` for the pair in `waitAndRead`. No behaviour change.
Extracts the
ICacheProvider/CacheWriterAPI changes from #115816 (the ReadPlan slice) into a standalone refactor, so that pull request carries only the read-plan logic. The experimentaluse_reader_executorread path (default off) is the only consumer.CacheWriter::committedreturns the committed-prefix end as asize_tinstead of anIntervalSet(a segment fills append-only, so what is committed is always one contiguous prefix). The disk writer reads the segment's live frontier directly and drops itscommitted_ranges/committed_mutexbookkeeping.claimLeadRoleloses itsByteRangeargument and returns just theClaim; theLeadstruct is removed. The caller reads the committed prefix viacommitted.CacheWriter::fillsWholeSegment, the writer-level mirror of the existingICacheProvider::fillsWholeSegment. It has no caller yet onmaster— Add a maintained ReadPlan to the experimental ReaderExecutor #115816 is its consumer — but it mirrors the provider-level flag, which is likewise not yet consumed.ICacheProvider::populatesOnMiss. A tier that does not populate now emits a writer-less miss fromresolve, which the executor already treats as read-from-source-only.No behavior change.
Related: #115816
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Workflow [PR]
Sync PR [sync-upstream/pr/116092]
Version info
26.9.1.888(included in26.9and later)