Skip to content

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

Open
mlibbey wants to merge 1 commit into
apache:masterfrom
mlibbey:prefetch-query-key-admission
Open

prefetch: only admit query-key requests that carry the key#13370
mlibbey wants to merge 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug prefetch prefetch plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants