Skip to content

Cancel async query on expiry#143016

Merged
dnhatn merged 7 commits intoelastic:mainfrom
dnhatn:delete-async-on-elapse
Mar 2, 2026
Merged

Cancel async query on expiry#143016
dnhatn merged 7 commits intoelastic:mainfrom
dnhatn:delete-async-on-elapse

Conversation

@dnhatn
Copy link
Copy Markdown
Member

@dnhatn dnhatn commented Feb 25, 2026

Today, we don’t cancel async queries when they expire. This means an async query continues running until it completes, unless the user explicitly deletes it. With this change, we will schedule a cancellation when an async query starts and reschedule the cancellation whenever the keep-alive is updated via get.

Closes #142662

@dnhatn dnhatn added :Analytics/ES|QL AKA ESQL >bug v9.3.2 v9.2.7 v8.19.13 auto-backport Automatically create backport pull requests when merged labels Feb 25, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @dnhatn, I've created a changelog YAML for you.

@dnhatn dnhatn requested review from ivancea and nik9000 February 25, 2026 21:16
@dnhatn dnhatn marked this pull request as ready for review February 25, 2026 21:16
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Feb 25, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @dnhatn, I've updated the changelog YAML for you.

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Copy Markdown
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

LGTM

@dnhatn
Copy link
Copy Markdown
Member Author

dnhatn commented Mar 2, 2026

Thanks Chris!

@dnhatn dnhatn merged commit 8feeac8 into elastic:main Mar 2, 2026
36 checks passed
@dnhatn dnhatn deleted the delete-async-on-elapse branch March 2, 2026 16:50
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💔 Backport failed

Status Branch Result
9.3 Commit could not be cherrypicked due to conflicts
8.19 Commit could not be cherrypicked due to conflicts
9.2 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 143016

szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 2, 2026
…locations

* upstream/main: (94 commits)
  Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/40_tsdb/TS Command grouping on text field} elastic#142544
  Mute org.elasticsearch.index.store.StoreDirectoryMetricsIT testDirectoryMetrics elastic#143419
  Mute org.elasticsearch.xpack.esql.qa.multi_node.GenerativeIT test elastic#143023
  TS_INFO information retrieval command (elastic#142721)
  ESQL: External source parallel execution and distribution (elastic#143349)
  Mute org.elasticsearch.index.mapper.blockloader.FlattenedFieldRootBlockLoaderTests testBlockLoaderForFieldInObject {preference=Params[syntheticSource=false, preference=DOC_VALUES]} elastic#143414
  Mute org.elasticsearch.index.mapper.blockloader.FlattenedFieldRootBlockLoaderTests testBlockLoaderForFieldInObject {preference=Params[syntheticSource=false, preference=NONE]} elastic#143413
  Mute org.elasticsearch.index.mapper.blockloader.FlattenedFieldRootBlockLoaderTests testBlockLoaderForFieldInObject {preference=Params[syntheticSource=false, preference=STORED]} elastic#143412
  Removing ingest random sampling (elastic#143289)
  Mute org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT test elastic#143023
  [Transform] Clean up internal tests (elastic#143246)
  Skip time series field type merge for non-TS agg queries (elastic#143262)
  Enable zero-copy SIMD vector scoring on searchable snapshots (frozen tier) (elastic#141718)
  Mute org.elasticsearch.xpack.search.CrossClusterAsyncSearchIT testCancelViaExpirationOnRemoteResultsWithMinimizeRoundtrips elastic#143407
  Fix MemorySegmentUtilsTests (elastic#143391)
  Unmute testWorkflowsRestrictionAllowsAccess (elastic#143308)
  Cancel async query on expiry (elastic#143016)
  ESQL: Finish migrating error testing (elastic#143322)
  Reduce LuceneOperator.Status memory consumption with large QueryDSL queries (elastic#143175)
  ESQL: Generative testing with full text functions (elastic#142961)
  ...
tballison pushed a commit to tballison/elasticsearch that referenced this pull request Mar 3, 2026
Today, we don’t cancel async queries when they expire. This means an 
async query continues running until it completes, unless the user
explicitly deletes it. With this change, we will schedule a cancellation
when an async query starts and reschedule the cancellation whenever the
keep-alive is updated via get.

Closes elastic#142662
@jsevidal13
Copy link
Copy Markdown

Hi, @dnhatn .

Could you please confirm whether or not this PR was or will be backported to 9.3.2?

Our customer had been waiting for this bug fix, and we said it would be available in 9.3.2 per the labels on this PR. However, this comment states that the backport failed, and I don't see the fix for it listed in the 9.3.2 release notes:

https://www.elastic.co/docs/release-notes/elasticsearch#elasticsearch-9.3.2-release-notes

dnhatn added a commit to dnhatn/elasticsearch that referenced this pull request Mar 24, 2026
Today, we don’t cancel async queries when they expire. This means an
async query continues running until it completes, unless the user
explicitly deletes it. With this change, we will schedule a cancellation
when an async query starts and reschedule the cancellation whenever the
keep-alive is updated via get.

Closes elastic#142662

(cherry picked from commit 8feeac8)
dnhatn added a commit to dnhatn/elasticsearch that referenced this pull request Mar 24, 2026
Today, we don’t cancel async queries when they expire. This means an
async query continues running until it completes, unless the user
explicitly deletes it. With this change, we will schedule a cancellation
when an async query starts and reschedule the cancellation whenever the
keep-alive is updated via get.

Closes elastic#142662

(cherry picked from commit 8feeac8)
@dnhatn
Copy link
Copy Markdown
Member Author

dnhatn commented Mar 24, 2026

💚 All backports created successfully

Status Branch Result
9.3
9.2
8.19

Questions ?

Please refer to the Backport tool documentation

dnhatn added a commit to dnhatn/elasticsearch that referenced this pull request Mar 24, 2026
Today, we don’t cancel async queries when they expire. This means an
async query continues running until it completes, unless the user
explicitly deletes it. With this change, we will schedule a cancellation
when an async query starts and reschedule the cancellation whenever the
keep-alive is updated via get.

Closes elastic#142662

(cherry picked from commit 8feeac8)
@dnhatn
Copy link
Copy Markdown
Member Author

dnhatn commented Mar 24, 2026

@jsevidal13 I'm so sorry; I missed the backport, and this fix unfortunately did not make it into 9.3.2. I am backporting it now, and it should be available in 9.3.3.

dnhatn added a commit that referenced this pull request Mar 24, 2026
Today, we don’t cancel async queries when they expire. This means an
async query continues running until it completes, unless the user
explicitly deletes it. With this change, we will schedule a cancellation
when an async query starts and reschedule the cancellation whenever the
keep-alive is updated via get.

Closes #142662

(cherry picked from commit 8feeac8)
dnhatn added a commit that referenced this pull request Mar 24, 2026
Today, we don’t cancel async queries when they expire. This means an
async query continues running until it completes, unless the user
explicitly deletes it. With this change, we will schedule a cancellation
when an async query starts and reschedule the cancellation whenever the
keep-alive is updated via get.

Closes #142662

(cherry picked from commit 8feeac8)
dnhatn added a commit that referenced this pull request Mar 24, 2026
Today, we don’t cancel async queries when they expire. This means an
async query continues running until it completes, unless the user
explicitly deletes it. With this change, we will schedule a cancellation
when an async query starts and reschedule the cancellation whenever the
keep-alive is updated via get.

Closes #142662

(cherry picked from commit 8feeac8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.14 v9.2.8 v9.3.3 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancel async query when keep_alive elapses

4 participants