-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add query.max-write-physical-size property #25958
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
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Vikas Harlani.
|
core/trino-main/src/main/java/io/trino/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/SqlQueryManager.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/StateMachine.java
Outdated
Show resolved
Hide resolved
8a57b13 to
1ff39e9
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Vikas Harlani.
|
core/trino-main/src/main/java/io/trino/execution/SqlQueryManager.java
Outdated
Show resolved
Hide resolved
1ff39e9 to
27f472e
Compare
2a3e493 to
9094774
Compare
9094774 to
f7696ff
Compare
testing/trino-tests/src/test/java/io/trino/tests/TestQueryManager.java
Outdated
Show resolved
Hide resolved
f7696ff to
5a449ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new configuration and session property to limit the total physical size of data written by a query, enforces it at runtime in the query manager, and updates docs and tests accordingly.
- Introduce
query.max-write-physical-sizeconfig andquery_max_write_physical_sizesession property. - Implement enforcement in
SqlQueryManagerwith a newenforceWriteLimitsmethod and exception. - Update documentation and add tests to verify write limit behavior.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| testing/trino-tests/src/test/java/io/trino/tests/TestQueryManager.java | Add tests to verify queries fail when write limit is exceeded. |
| docs/src/main/sphinx/admin/properties-query-management.md | Document the new query.max-write-physical-size property. |
| core/trino-spi/src/main/java/io/trino/spi/StandardErrorCode.java | Define EXCEEDED_WRITE_LIMIT error code. |
| core/trino-main/src/test/java/io/trino/execution/TestQueryManagerConfig.java | Extend config tests for query.max-write-physical-size. |
| core/trino-main/src/main/java/io/trino/execution/StateMachine.java | Fix Javadoc formatting. |
| core/trino-main/src/main/java/io/trino/execution/SqlQueryManager.java | Add maxQueryWritePhysicalSize field, enforcement loop, and exception handling. |
| core/trino-main/src/main/java/io/trino/execution/QueryManagerConfig.java | Add queryMaxWritePhysicalSize configuration property. |
| core/trino-main/src/main/java/io/trino/SystemSessionProperties.java | Register query_max_write_physical_size session property and getter. |
| core/trino-main/src/main/java/io/trino/ExceededWriteLimitException.java | Implement exception thrown when write limits are exceeded. |
Comments suppressed due to low confidence (1)
core/trino-main/src/main/java/io/trino/execution/SqlQueryManager.java:399
- The code references
Ordering.natural()but there is no import forcom.google.common.collect.Ordering. Please add the missing import so the code compiles.
.flatMap(sessionLimit -> maxQueryWritePhysicalSize.map(serverLimit -> Ordering.natural().min(serverLimit, sessionLimit)))
Description
This pull request adds a new config and session property:
query_max_write_physical_size, similar to the existingquery_max_scan_physical_bytes. It allows users to set an upper limit on the total physical size written by a query.Due to Trino’s distributed execution model, this value serves as a lower bound rather than a strict limit. Queries that slightly exceed this threshold may still succeed; queries under this threshold will not be failed.
Additional context and related issues
fixes #25955
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: