slice: Avoid redundant prefetch re-scheduling - #13215
Merged
Merged
Conversation
schedule_prefetch() ran on every server response and re-issued blocks already scheduled this request, which the in-flight dedup set does not catch. Track a per-request high-water mark so each block is prefetched at most once; update the slice_prefetch gold. Supersedes apache#13212. Co-authored-by: Masaori Koshiba <masaori@apache.org>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the slice plugin’s prefetch behavior to avoid re-scheduling the same background-fetch blocks multiple times within a single transaction by tracking a per-request “high-water mark” of prefetched blocks. This addresses redundant prefetch requests that could race with inline reads, and updates the slice_prefetch gold output accordingly.
Changes:
- Track a per-request prefetch high-water mark in
Dataso each block is scheduled for prefetch at most once per request. - Update
schedule_prefetch()to skip blocks at or below the recorded high-water mark and advance the mark after scheduling. - Update the
slice_prefetchgold file to reflect the new request/response pattern.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/gold_tests/pluginTest/slice/gold/slice_prefetch.gold | Updates expected output for slice prefetch behavior changes. |
| plugins/slice/util.cc | Skips redundant prefetch scheduling using a per-request high-water mark and updates it after scheduling. |
| plugins/slice/Data.h | Adds the per-request prefetch high-water mark field. |
Block numbers are int64_t (Range, Data::m_blocknum); widen the prefetch high-water mark and loop accordingly and narrow only at the BgBlockFetch::schedule() boundary. Addresses Copilot review.
cmcfarlen
approved these changes
May 29, 2026
Contributor
|
Cherry-picked to 10.2.x |
cmcfarlen
pushed a commit
that referenced
this pull request
Jun 16, 2026
* slice: Avoid redundant prefetch re-scheduling schedule_prefetch() ran on every server response and re-issued blocks already scheduled this request, which the in-flight dedup set does not catch. Track a per-request high-water mark so each block is prefetched at most once; update the slice_prefetch gold. Supersedes #13212. Co-authored-by: Masaori Koshiba <masaori@apache.org> * slice: Address Copilot review (m_prefetch_hwm -> int) * slice: Use int64_t for prefetch block math Block numbers are int64_t (Range, Data::m_blocknum); widen the prefetch high-water mark and loop accordingly and narrow only at the BgBlockFetch::schedule() boundary. Addresses Copilot review. --------- Co-authored-by: Masaori Koshiba <masaori@apache.org> (cherry picked from commit bcddd98)
cmcfarlen
pushed a commit
to cmcfarlen/trafficserver
that referenced
this pull request
Jul 29, 2026
* slice: Avoid redundant prefetch re-scheduling schedule_prefetch() ran on every server response and re-issued blocks already scheduled this request, which the in-flight dedup set does not catch. Track a per-request high-water mark so each block is prefetched at most once; update the slice_prefetch gold. Supersedes apache#13212. Co-authored-by: Masaori Koshiba <masaori@apache.org> * slice: Address Copilot review (m_prefetch_hwm -> int) * slice: Use int64_t for prefetch block math Block numbers are int64_t (Range, Data::m_blocknum); widen the prefetch high-water mark and loop accordingly and narrow only at the BgBlockFetch::schedule() boundary. Addresses Copilot review. --------- Co-authored-by: Masaori Koshiba <masaori@apache.org>
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.
schedule_prefetch() ran on every server response and re-issued blocks already scheduled this request, which the in-flight dedup set does not catch. Track a per-request high-water mark so each block is prefetched at most once; update the slice_prefetch gold. Supersedes #13212.