Skip to content

Conversation

@dnhatn
Copy link
Member

@dnhatn dnhatn commented May 20, 2025

The search context variable should be inside the loop, not outside; otherwise, it may close the previous search context when the target shard is unavailable, potentially leaving search contexts without references. This bug was introduced in unreleased versions (9.1 and 8.19). I think we need to refactor DataNodeComputeHandler to allow writing unit tests for these cases easier, but testSearchWhileRelocating should cover this issue.

Closes #127188

@dnhatn dnhatn requested review from idegtiarenko and nik9000 May 20, 2025 21:06
@dnhatn dnhatn marked this pull request as ready for review May 20, 2025 21:06
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 20, 2025
@elasticsearchmachine
Copy link
Collaborator

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

throw e;
}
}
searchContexts.add(context);
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I believe it is a bit more readable if context is added in the end of the try block as this emphasizes it is only added when operation is completely successful. Otherwise it looks like a null could be added to a collection sometimes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I've updated this in 6a89947

@nik9000
Copy link
Member

nik9000 commented May 21, 2025

Very sneaky. I'd have written it inside the loop every time so I super wouldn't see this.

@dnhatn dnhatn added the auto-backport Automatically create backport pull requests when merged label May 21, 2025
@dnhatn
Copy link
Member Author

dnhatn commented May 21, 2025

@idegtiarenko @nik9000 Thanks for the discussion and reviews :)

@dnhatn dnhatn merged commit e230c01 into elastic:main May 21, 2025
18 checks passed
@dnhatn dnhatn deleted the fix-search-contexts branch May 21, 2025 17:38
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

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

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

elasticsearchmachine pushed a commit that referenced this pull request Oct 23, 2025
This should been fixed in #128222

Relates #128222 Closes #126580
fzowl pushed a commit to voyage-ai/elasticsearch that referenced this pull request Nov 3, 2025
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 backport pending >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] DataNodeRequestSenderIT testSearchWhileRelocating failing

4 participants