-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add query.max-run-time.hard-limit #15115
Conversation
core/trino-main/src/main/java/io/trino/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
@nevillelyh Bounds is what we have |
dc94c5a
to
e548316
Compare
Yeah I'm aware of the Not sure about the |
Fair point. Let's have some English native person speak here. |
Is there really a use-case for turning this off at the cluster level? I could see granting individual users, or an admin role permission to do it, but for all users in a cluster I'm not so sure. As far as the naming goes, maybe |
Feels like access control & upper bound are orthogonal.
|
I can imagine a use-case where Also, a session property can be set by users directly, but it can also be set via a Session Property Manager installed on the coordinator. Such use also would be better served with a hard limit. Sorry that I didn't think about this before. @nevillelyh can you adjust? |
Sounds good. That actually seems to be a better solution. Something like |
e548316
to
23ef576
Compare
23ef576
to
8faf433
Compare
You can leave default for |
Or should the default be set to be the same as the query max run time and admins have to opt-in to allow users to extend it? |
While this feel like the more desirable default, it's a breaking change and might be hard to explain, i.e. @hashhar I went with your suggestion. |
8faf433
to
e13c52a
Compare
|
core/trino-main/src/main/java/io/trino/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
676f536
to
d05996d
Compare
core/trino-main/src/main/java/io/trino/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/TestSystemSessionProperties.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/TestSystemSessionProperties.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/execution/TestQueryManagerConfig.java
Show resolved
Hide resolved
allowed time for a query may be raised for a session using the | ||
``query_max_run_time`` session property, but must not exceed this hard limit | ||
if it is specified. | ||
|
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.
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.
Late to the party, but it looks good.
d05996d
to
2f6f368
Compare
Co-authored-by: Ashhar Hasan <[email protected]>
2f6f368
to
58e3738
Compare
@findepi addressed all comments |
I'm not sure I understand the use case for this. In the past, we've actively discouraged from adding more knobs and configuration options like these (if I recall, we even considered something like this specific option but concluded it wasn't necessary). The existing option is already a hard limit, and can only be changed by users that have permissions to do so. If someone wants to run a query with a lower time bound, they can kill the query when the desired time elapses. There might be other options, too, like allowing the session property to be lowered but not increased beyond the value of the config option. My concerns are:
|
I don't think this is a reasonable argument. We've had the time limit session property for years as a convenient and often used way to automatically limit the runtime. You're telling administrators that if they want to limit the upper bound for the max runtime, their users must now stop using this feature and write custom code to externally kill the query after a time limit,(which is especially difficult if executing the query using a normal tool where the query ID isn't exposed).
The existing config property
This a potentially good option. The problem is that the security check This might be less flexible than a hard-limit system, which lets an administrator specify both a default and an upper bound. Query maximum memory is the other use case that comes to mind. The admin might want to have a default of say 100GB but have an upper bound of 1TB for users who need it. We have no way to allow this type of configuration today. |
It's a hard limit in that queries won't exceed that time. If it's protected with ACLs, then no one other than authorized users should be able to change it. In any case, I don't think it's tenable to add a "hard-limit" version for every knob that already exists. Aside from memory limits, there are options for max analysis time, max execution time, max planning time, max CPU time and max data scanned. We need a better way. Since the motivation for this change is not clear, and the discussion in the comments seems to be very speculative (about what someone might want to do), I'd prefer to err on the side of not adding the new option and doing it in a more principled way. Once the option is there, it's harder to remove later due to backward compatibility issues. |
The use case is described in the proposed release notes in a more end-user friendly manner #15058 (comment)
Previously it wasn't possible to configure a system so that users can set query_max_run_time but within some allowed range. |
Seems to be the root of the underlying issue. Can https://trino.io/docs/current/security/file-system-access-control.html#session-property-rules not solve this and other related issues? |
It can address the original motivation of this PR, which was to disallow changing |
How would this help for draining? |
Description
Add
query.max-run-time.hard-limit
.The maximum allowed time for a query may be raised on a per-query basis using the
query_max_run_time
session property, but may not exceed this hard limit if it is specified.Additional context and related issues
Release notes
( ) This is not user-visible or 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: