Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect warnings in compute service #103031

Merged
merged 7 commits into from
Dec 6, 2023
Merged

Collect warnings in compute service #103031

merged 7 commits into from
Dec 6, 2023

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Dec 6, 2023

We have implemented #99927 in DriverRunner. However, we also need to implement this in ComputeService, where we spawn multiple requests to avoid losing response headers.

Relates #99927

Closes #100163
Closes #102982
Closes #102871
Closes #103028

/**
* A helper class that can be used to collect and merge response headers from multiple child requests.
*/
public final class ResponseHeadersCollector {
Copy link
Member Author

Choose a reason for hiding this comment

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

This class was extracted from DriverRunner.

@elasticsearchmachine
Copy link
Collaborator

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

@dnhatn dnhatn requested review from nik9000 and bpintea December 6, 2023 04:38
@dnhatn dnhatn marked this pull request as ready for review December 6, 2023 04:38
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:QL (Deprecated) Meta label for query languages team label Dec 6, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL)

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

LGTM

internalCluster().ensureAtLeastNumDataNodes(2);
final String node1, node2;
if (randomBoolean()) {
internalCluster().ensureAtLeastNumDataNodes(2);
Copy link
Contributor

Choose a reason for hiding this comment

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

is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

++, I fixed this in 7948638

client().admin().indices().prepareRefresh("index-1", "index-2").get();

EsqlQueryRequest request = new EsqlQueryRequest();
request.query("FROM index-* | EVAL ip = to_ip(host) | STATS s = COUNT(*) by ip | KEEP ip | LIMIT 100");
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the STATS here, given that the to_ip() will fail for every document? (just curious)

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to add a STATS for executing eval on data nodes. This is needed to reproduce the issue.

.toList();
int expectedWarnings = Math.min(20, numDocs1 + numDocs2);
// we cap the number of warnings per node
assertThat(warnings.size(), greaterThanOrEqualTo(expectedWarnings));
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't warnings.size() == expectedWarnings + 1 (the + 1 being the header detailing the expression that failed)?

Copy link
Member Author

Choose a reason for hiding this comment

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

We cap the number of warnings per execution pipeline, and we don't limit them again when merging the result on the coordinator; hence, we need to relax the assertion here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, true (and it was right there in the comment). Thanks!

@dnhatn
Copy link
Member Author

dnhatn commented Dec 6, 2023

@bpintea @nik9000 Thanks for reviewing.

@dnhatn dnhatn merged commit be1277a into elastic:main Dec 6, 2023
9 of 15 checks passed
@dnhatn dnhatn deleted the warnings branch December 6, 2023 17:14
@elasticsearchmachine
Copy link
Collaborator

elasticsearchmachine commented Dec 6, 2023

Backport PR: #103079

dnhatn added a commit to dnhatn/elasticsearch that referenced this pull request Dec 6, 2023
We have implemented elastic#99927 in DriverRunner. However, we also need to
implement this in ComputeService, where we spawn multiple requests to
avoid losing response headers.

Relates elastic#99927

Closes elastic#100163
Closes elastic#102982
Closes elastic#102871
Closes elastic#103028
elasticsearchmachine pushed a commit that referenced this pull request Dec 6, 2023
We have implemented #99927 in DriverRunner. However, we also need to
implement this in ComputeService, where we spawn multiple requests to
avoid losing response headers.

Relates #99927

Closes #100163
Closes #102982
Closes #102871
Closes #103028
bpintea added a commit to bpintea/elasticsearch that referenced this pull request Dec 18, 2023
Re-enable a couple of warning header checking tests that have been
disabled, but mistakenly without linking the issue (elastic#100163), which lead
to them being kept disabled also after the fix (elastic#103031).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment