Skip to content

[8.x] Fix SearchTimeoutIT (#120390)#122203

Merged
elasticsearchmachine merged 2 commits intoelastic:8.xfrom
javanna:backport/8.x/pr-120390
Feb 11, 2025
Merged

[8.x] Fix SearchTimeoutIT (#120390)#122203
elasticsearchmachine merged 2 commits intoelastic:8.xfrom
javanna:backport/8.x/pr-120390

Conversation

@javanna
Copy link
Copy Markdown
Contributor

@javanna javanna commented Feb 10, 2025

8.x backport of #120390

Two of the timeout tests have been muted for several months. The reason is that we tightened the assertions to cover for partial results being returned, but there were edge cases in which partial results were not actually returned.

The timeout used in the test was time dependent, hence when the timeout precisely will be thrown is unpredictable, because we have timeout checks in different places in the codebase, when iterating through the leaves, before scoring any document, or while scoring documents. The edge case that caused failures is a typical timing issue where the initial check for timeout in CancellableBulkScorer already triggers the timeout, before any document has been collected.

I made several adjustments to the test to make it more robust:
- use index random to index documents, that speeds it up
- share indexing across test methods, so that it happens once at the suite level
- replace the custom query that triggers a timeout to not be a script query, but rather a lucene query that is not time dependent, and throws a time exceeded exception precisely where we expect it, so that we can test how the system reacts to that. That allows to test that partial results are always returned when a timeout happens while scoring documents, and that partial results are never returned when a timeout happens before we even started to score documents.

Closes elastic#98369
Closes elastic#98053
@javanna javanna added >test Issues or PRs that are addressing/adding tests backport auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Search Foundations/Search Catch all for Search Foundations v8.19.0 labels Feb 10, 2025
@javanna javanna changed the title Fix SearchTimeoutIT (#120390) [8.x] Fix SearchTimeoutIT (#120390) Feb 10, 2025
@elasticsearchmachine elasticsearchmachine merged commit 8956208 into elastic:8.x Feb 11, 2025
@javanna javanna deleted the backport/8.x/pr-120390 branch February 11, 2025 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport :Search Foundations/Search Catch all for Search Foundations >test Issues or PRs that are addressing/adding tests v8.19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants