Skip to content

Conversation

@n1v0lg
Copy link
Contributor

@n1v0lg n1v0lg commented Dec 12, 2024

Small tweak around how data node requests handle no indices w.r.t. shards.

@n1v0lg n1v0lg requested review from jakelandis and nik9000 December 12, 2024 13:07
@n1v0lg n1v0lg marked this pull request as ready for review December 12, 2024 17:59
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Dec 12, 2024
import static org.elasticsearch.xpack.esql.EsqlTestUtils.loadMapping;
import static org.elasticsearch.xpack.esql.EsqlTestUtils.withDefaultLimitWarning;

public class DataNodeRequestSerializationTests extends AbstractWireSerializingTestCase<DataNodeRequest> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed the existing DataNodeRequestTests suite to DataNodeRequestSerializationTests, then add a new DataNodeRequestTests. Nothing in DataNodeRequestSerializationTests is new whereas DataNodeRequestTests is net new. Sorry for the confusing diff here.

@Override
public IndicesRequest indices(String... indices) {
this.indices = indices;
if (Arrays.asList(indices).contains(NO_INDEX_PLACEHOLDER)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nik9000 just a heads up: discussed with Jake and its cleaner to move this here since that's what gets called in index resolution with NO_INDEX_PLACEHOLDER (as opposed to keep in the get). LMK if you have objections!

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should we check the length of the String[] for == 1 && contains no index place holder as an optimization ? It could short circuit (or remove) the need to convert to a List as well as a (presumable) O(N) check where N is all the allowed indices per pattern which could be quite a large list for large clusters with many indices.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call -- it's actually NO_INDICES_OR_ALIASES_ARRAY that gets passed in which is two elements. So I'm going with Arrays.equals(indices, NO_INDICES_OR_ALIASES_ARRAY) || Arrays.asList(indices).contains(NO_INDEX_PLACEHOLDER) -- Arrays.equals does the optimizations under the hood and then we fall back to the expensive check just to be more future-proof.

Copy link
Contributor

@jakelandis jakelandis left a comment

Choose a reason for hiding this comment

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

LGTM

(one minor comment for possible optimization)

@n1v0lg n1v0lg added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Dec 16, 2024
@elasticsearchmachine elasticsearchmachine merged commit 7585f02 into elastic:main Dec 16, 2024
16 checks passed
@n1v0lg n1v0lg deleted the compute-request-no-indices branch December 16, 2024 10:07
@n1v0lg
Copy link
Contributor Author

n1v0lg commented Dec 16, 2024

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

n1v0lg added a commit to n1v0lg/elasticsearch that referenced this pull request Dec 16, 2024
Small tweak around how data node requests handle no indices w.r.t.
shards.

(cherry picked from commit 7585f02)
elasticsearchmachine pushed a commit that referenced this pull request Dec 16, 2024
Small tweak around how data node requests handle no indices w.r.t.
shards.

(cherry picked from commit 7585f02)
maxhniebergall pushed a commit to maxhniebergall/elasticsearch that referenced this pull request Dec 16, 2024
Small tweak around how data node requests handle no indices w.r.t.
shards.

(cherry picked from commit 7585f02)
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-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.17.1 v8.18.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants