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

ESQL: Limit how many bytes concat() can process #100360

Merged
merged 12 commits into from
Oct 9, 2023

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Oct 5, 2023

This adds a limit on the bytes length that a concatenated string can get to.
The limit is set to 1MB (per entry).
When the limit is hit, an exception is returned to the caller (similar to an accounting circuit breaking) and execution halted.

Related: #100288.

This adds a limit on the bytes length that a concatenated string can get
to.
The limit is set to 10MB (per entry).
When the limit is hit, an exception is returned to the caller (similar
to an accounting circuit breaking).
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@bpintea bpintea requested a review from nik9000 October 5, 2023 18:05
Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

It's probably worth a unit test as well.

@@ -168,11 +168,24 @@ public void testSmallConcat() throws IOException {
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99826")
// TODO: drop testHugeConcatRejected() once this is fixed
public void testHugeConcat() throws IOException {
initSingleDocIndex();
assertCircuitBreaks(() -> concat(10));
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we just replace the body of this with testHugeConcatRejected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced.

- grow cratch builder with the checked length of input arguments
- replace disabled test
Lower max concat len to 1MB
Lower max concat len to 1MB in test.
@bpintea
Copy link
Contributor Author

bpintea commented Oct 6, 2023

It's probably worth a unit test as well.

Integrating this exception into the unit tests is doable, but not cleanly: either having a dedicated test ignoring the test providers (but being run against all of them), or contriving a test with warnings and type errors to avoid running most of the inherited tests. I've left it out for now, but I can add it in a follow up if needed.

I've also lowered the limit to 1MB, since 10MB still generates OOMs in integration tests. Noteworthy, also integration tests VM OOMs with 10MB of test data.

@nik9000
Copy link
Member

nik9000 commented Oct 6, 2023

Integrating this exception into the unit tests is doable, but not cleanly: either having a dedicated test ignoring the test providers (but being run against all of them), or contriving a test with warnings and type errors to avoid running most of the inherited tests. I've left it out for now, but I can add it in a follow up if needed.

I'd bang up a dedicated unit test for it. I think it's probably worth it, but I get that it's annoying with all the providers in the way.

@bpintea bpintea added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) auto-backport-and-merge labels Oct 6, 2023
Switch to lower frequency of oversized handling.
Stop checking after oversize test
@bpintea bpintea added the buildkite-opt-in Opts your PR into Buildkite instead of Jenkins label Oct 6, 2023
@bpintea
Copy link
Contributor Author

bpintea commented Oct 6, 2023

@elasticsearchmachine run elasticsearch-ci/part-2

@bpintea
Copy link
Contributor Author

bpintea commented Oct 6, 2023

@elasticsearchmachine run elasticsearch-ci/part-2

1 similar comment
@bpintea
Copy link
Contributor Author

bpintea commented Oct 9, 2023

@elasticsearchmachine run elasticsearch-ci/part-2

@bpintea bpintea removed the buildkite-opt-in Opts your PR into Buildkite instead of Jenkins label Oct 9, 2023
@bpintea
Copy link
Contributor Author

bpintea commented Oct 9, 2023

@elasticsearchmachine run elasticsearch-ci/part-2

@bpintea
Copy link
Contributor Author

bpintea commented Oct 9, 2023

@elasticsearchmachine run elasticsearch-ci/part-3

@elasticsearchmachine elasticsearchmachine merged commit c879775 into elastic:main Oct 9, 2023
@bpintea bpintea deleted the fix/limit_concat_len branch October 9, 2023 11:45
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.11

bpintea added a commit to bpintea/elasticsearch that referenced this pull request Oct 9, 2023
This adds a limit on the bytes length that a concatenated string can get
to. The limit is set to 1MB (per entry). When the limit is hit, an
exception is returned to the caller (similar to an accounting circuit
breaking) and execution halted.

Related: elastic#100288.
elasticsearchmachine pushed a commit that referenced this pull request Oct 9, 2023
This adds a limit on the bytes length that a concatenated string can get
to. The limit is set to 1MB (per entry). When the limit is hit, an
exception is returned to the caller (similar to an accounting circuit
breaking) and execution halted.

Related: #100288.
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!) >bug Team:QL (Deprecated) Meta label for query languages team v8.11.0 v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants