prefetcher: ERROR on admit saturation#122
Draft
nclack wants to merge 1 commit into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## worktree-prefetch #122 +/- ##
==================================================
Coverage 58.21% 58.22%
==================================================
Files 56 56
Lines 7948 7956 +8
Branches 1396 1396
==================================================
+ Hits 4627 4632 +5
- Misses 2746 2753 +7
+ Partials 575 571 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
What was broken
admit_lockedinsrc/prefetch/prefetcher.chad two silent-drop paths whenadmission couldn't proceed: when
batch_get_or_create_lockedreturned NULL(all
batch_capacityentries in use) and whenprefetch_cache_requestreturned an invalid handle (e.g., array_meta cache eviction blocked). Both
paths freed
popped->uri, bumpederrored, and discarded the sample withno observable signal. A caller pushing many distinct batches faster than
they drain would see batches silently vanish instead of getting a clean
saturation report.
The fix
admit_lockednow treats both failure modes as terminalPREFETCHER_ERRORslots carrying
uri/aabb/batch_idfrom the popped sample anderr_code = DAMACY_OOM. The slot follows the same lifecycle as asuccessful admission: the caller observes it through
prefetcher_pop_ready/prefetcher_pop_ready_for_batch, releases theURI via
prefetcher_ready_free, and (for the cache-failure case where abatch entry was acquired) optionally calls
prefetcher_release_batchtoreclaim the gate.
Routing the synthetic ERROR into the free slot the worker already found
keeps the change small — no new overflow queue, no change to
worker_fn.emit_error_slot_lockedis the only new helper.admit_lockedkeeps asingle
Dropfall-through label as a CHECK_SILENT guard against thehypothetical NULL-slot case (worker_fn never reaches that path today).
Key change:
src/prefetch/prefetcher.c::admit_locked(~line 312).How the user observes saturation
test_batch_capacity_saturation_surfaces_errorintests/test_prefetcher.cwalks that loop end-to-end. The existing
test_admit_fail_releases_batch_entrywas updated to pop the ERROR slot and call
release_batchbefore assertingthe gate is gone — the entry lifetime now matches the successful-admission
contract.