Skip to content

fix(core): describe looks a remembered missing index up again - #470

Merged
fupelaqu merged 2 commits into
mainfrom
fix/describe-remembered-miss
Nov 21, 2026
Merged

fupelaqu merged 2 commits into
mainfrom
fix/describe-remembered-miss

Conversation

@fupelaqu

Copy link
Copy Markdown
Contributor

Summary

describe now answers what run would answer for an index that another client created after a query found it missing.

After a 404 on an index, the client remembers the miss for up to five minutes so that run does not pay a failed lookup on every statement. Until now describe read that remembered miss too. If another client then created the index (an ingest that auto-creates it, a raw PUT), describe kept answering 404 while run executed normally. A consumer that types its results through describe before running them refused the statement for up to five minutes.

Change

  • One function decides for every reader of a remembered miss, in the mode of its call:
    • run (an executing statement, and a subquery while it executes) keeps the negative cache: no lookup while the miss stands, as before.
    • describe (its attach, its pre-execution subquery scope check, per-table legs, derived-table sources) always looks the source up again. A success forgets the miss, so the next run is typed. A 404 remembers it afresh.
  • The describe memo still stores successes only, so no stale answer survives the moment the index appears.
  • No configuration change and no case-class arity change, so no downstream rebuild is needed.

Cost

A describe of an index that is still absent repeats the failed lookup on every call: a GET <index> and a lookup of the template of that name. That is two round trips, logged as several WARN lines. This is an error path. The negative cache of run is unchanged. The scaladoc and documentation/client/search.md state it.

Testing

  • New DescribeRememberedMissSpec, 10 cases: it fails on the base commit 10/10 and passes here. It covers describe(sql), describe(statement), derived bodies, per-table describe, run-mode unchanged, the memo across the transition, and the subquery scope check.
  • Core unit suites in the area: 255 passed, 0 failed. + compile passes on Scala 2.12 and 2.13.
  • Elasticsearch 8.18.3: 246 passed, 0 failed in the schema area suites (describe/run parity, schema consumer, per-table describe, GROUP BY completeness, schema reading, schema miss after CREATE TABLE, WHERE subqueries, among others). 211 passed, 0 failed in a second set of client suites.
  • CI lint line (headerCheck scalafmtSbtCheck scalafmtCheck test:scalafmtCheck) passes.
  • Not run locally: Elasticsearch 6.8, 7 and 9 (CI).

Release note

describe no longer answers a remembered 404 for an index another client created since; its successful lookup also lets the next run be typed at once.

Recorded, not fixed (pre-existing, not widened)

  • A wrapper client keeps its own map of remembered misses, separate from the client it wraps, as before.
  • Within the five-minute window, a run that no describe precedes still runs untyped over an index found missing earlier. This is the negative cache this change keeps on purpose.

🤖 Generated with Claude Code

fupelaqu and others added 2 commits November 20, 2026 10:33
… would answer it (SCHEMA-17)

Story SCHEMA-17-R169. Reviewed: r0:clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…EMA-17)

A describe of an index that is still absent repeats the failed lookup on
every call: a GET of the index and a lookup of the template of that name,
two round trips logged as several WARN lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fupelaqu
fupelaqu marked this pull request as ready for review November 20, 2026 15:28
@fupelaqu
fupelaqu merged commit eb7e014 into main Nov 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant