Skip to content

[ES|QL] Fix ES|QL columns reset race during active fetch#263947

Merged
bartoval merged 3 commits intoelastic:mainfrom
bartoval:discover-esql-columns-reset-race
Apr 22, 2026
Merged

[ES|QL] Fix ES|QL columns reset race during active fetch#263947
bartoval merged 3 commits intoelastic:mainfrom
bartoval:discover-esql-columns-reset-race

Conversation

@bartoval
Copy link
Copy Markdown
Contributor

@bartoval bartoval commented Apr 17, 2026

Summary

Closes #255817

When a transformational ES|QL fetch changes the available columns, Discover requests a temporary columns reset. Before this change, that reset also changed resetId even though it was triggered by the active fetch itself.

That could prevent cleanup from running when the first fetch finished, leaving the columns reset armed longer than intended.

This was most visible in Serverless Observability because its data source profiles provide default columns that can override ES|QL KEEP columns when the stale reset is consumed.

fix.mp4

@bartoval bartoval self-assigned this Apr 17, 2026
}),
},

setProfileStateFieldsToResetWithoutResetId: (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Better a new action that represents a semantic exception than a flag on the previous action.

@bartoval bartoval added v9.5.0 bug Fixes for quality problems that affect the customer experience Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Feature:ES|QL ES|QL related features in Kibana Feature:Discover Discover Application labels Apr 17, 2026
@bartoval bartoval marked this pull request as ready for review April 17, 2026 05:31
@bartoval bartoval requested a review from a team as a code owner April 17, 2026 05:31
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@bartoval bartoval added backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes labels Apr 17, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #130 / Dashboard save a search sessions TSVB & Timelion Restore session with TSVB & Timelion

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.9MB 1.9MB +174.0B

cc @bartoval

Copy link
Copy Markdown
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

It's a strange one, thanks for the fix!

Comment on lines +159 to +161
// This reset comes from the current fetch, so keep the same resetId.
// Otherwise the snapshot taken at fetch start looks stale when cleanup runs.
injectCurrentTab(internalStateActions.setProfileStateFieldsToResetWithoutResetId)({
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.

I went down the rabbit hole on this and funny enough, it seems like this is likely dead code anyway (other than the bug 🙃). Not certain yet so these changes are good for now until we investigate, but opened a separate issue for it here: #264870.

@bartoval bartoval merged commit 0d08933 into elastic:main Apr 22, 2026
17 checks passed
mbondyra added a commit to mbondyra/kibana that referenced this pull request Apr 22, 2026
…sationChanges23

* commit '9a7b717c662d1c904052bc59f0e5a81daab87c7f': (145 commits)
  Upgrade EUI to v114.2.0 (elastic#264550)
  [Entity Analytics] Add missing OpenAPI descriptions and examples to p… (elastic#264778)
  [Entity Resolution] Clarify CSV upload result for already-linked entities (elastic#264689)
  [AI Infra] Fix failing GenAI Settings Scout tests (elastic#260496)
  [Agent Builder] [Bug Bash] OAuth connector settings mention fields that are not there (elastic#264756)
  [performance] process-wide cache for advanced settings lookup (elastic#262618)
  [CI] Update limits.yml for securitySolution (elastic#264946)
  [SLO] Fix APM embeddable ids (elastic#264750)
  [EDR Workflows] Unify artifacts empty state buttons (elastic#264389)
  [Alert Triage workflow] Adds security.buildAlertEntityGraph and security.renderAlertNarrative… (elastic#259159)
  [SigEvents] Add KI feature identification endpoints and refactor task to use shared service (elastic#263528)
  [Scout] Migrate Data Views API tests from FTR - Part5 (elastic#264088)
  [Cases] Apply shared extended_fields path util server side (elastic#264706)
  [Lens as code] Fix metric trendline (elastic#264777)
  [api-docs] 2026-04-22 Daily api_docs build (elastic#264882)
  [Scout] Update test config manifests (elastic#264575)
  [workflows_management] Lazy-load Zod connector schemas to cut idle memory (elastic#264283)
  [ES|QL] Fix ES|QL columns reset race during active fetch (elastic#263947)
  [Content List] Column layout props, sticky actions, and title click handlers (elastic#264203)
  [Lens as code] Validate `id` in route for new vis types (elastic#264480)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting bug Fixes for quality problems that affect the customer experience Feature:Discover Discover Application Feature:ES|QL ES|QL related features in Kibana release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover] [ES|QL] KEEP columns disappear after re-executing the same query

4 participants