Skip to content

prefetch: only admit query-key requests that carry the key - #13370

Merged
mlibbey merged 1 commit into
apache:masterfrom
mlibbey:prefetch-query-key-admission
Jul 18, 2026
Merged

prefetch: only admit query-key requests that carry the key#13370
mlibbey merged 1 commit into
apache:masterfrom
mlibbey:prefetch-query-key-admission

Conversation

@mlibbey

@mlibbey mlibbey commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

With --fetch-query configured, the front-end/first-pass gate set handleFetch=true whenever the query key was configured, not when the request actually carried it. So every request whose path matched no fetch-path-pattern was admitted anyway, ran the pattern replace, failed, and logged ERROR "failed to process the pattern" -- while scheduling no prefetch at all (BgFetch runs only on the success path).

@mlibbey
mlibbey requested a review from vmamidi July 8, 2026 03:55
@JosiahWI JosiahWI added Bug prefetch prefetch plugin labels Jul 8, 2026
@JosiahWI JosiahWI added this to the 11.0.0 milestone Jul 8, 2026
@JosiahWI
JosiahWI requested a review from Copilot July 8, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the prefetch plugin’s front-end/first-pass admission logic so --fetch-query only enables prefetch handling when the incoming request actually carries the configured query key, preventing unnecessary pattern processing and related error logs.

Changes:

  • Gate handleFetch on presence of the configured query key in the request’s pristine URL query string (instead of only on configuration).
  • Avoid extra “failed to process the pattern” error paths when no prefetch can be scheduled.

Comment thread plugins/prefetch/plugin.cc
With --fetch-query configured, the front-end/first-pass gate set
handleFetch=true whenever the query key was *configured*, not when the
request carried it. So every request whose path matched no
fetch-path-pattern was admitted anyway, ran the pattern replace, failed,
and logged ERROR "failed to process the pattern" -- while scheduling no
prefetch at all (BgFetch runs only on the success path).

Admit only when the request's query actually contains the key, matched
as a "<key>=" parameter rather than a substring (which could hit another
parameter's name or value). The same parameter test is now used by the
hasValidQuery branch selector and the query-branch loop as well.
@mlibbey
mlibbey force-pushed the prefetch-query-key-admission branch from d248eba to cdc7088 Compare July 8, 2026 17:32
@bryancall
bryancall requested a review from moonchen July 13, 2026 22:20

@moonchen moonchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you for making the matches more precise.

@mlibbey
mlibbey merged commit 03652e4 into apache:master Jul 18, 2026
15 checks passed
@mlibbey
mlibbey deleted the prefetch-query-key-admission branch July 18, 2026 23:45
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jul 29, 2026
…pache#13370)

With --fetch-query configured, the front-end/first-pass gate set
handleFetch=true whenever the query key was *configured*, not when the
request carried it. So every request whose path matched no
fetch-path-pattern was admitted anyway, ran the pattern replace, failed,
and logged ERROR "failed to process the pattern" -- while scheduling no
prefetch at all (BgFetch runs only on the success path).

Admit only when the request's query actually contains the key, matched
as a "<key>=" parameter rather than a substring (which could hit another
parameter's name or value). The same parameter test is now used by the
hasValidQuery branch selector and the query-branch loop as well.

(cherry picked from commit 03652e4)
@cmcfarlen cmcfarlen moved this to Picked v10.2.0 in ATS v10.2.x Jul 29, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Jul 29, 2026
@github-project-automation github-project-automation Bot moved this from Picked v10.2.0 to For v10.2.0 in ATS v10.2.x Jul 29, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug prefetch prefetch plugin

Projects

Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

5 participants