-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add physical data scan tracking to resource groups #25113
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
a9ca3a5 to
8841fac
Compare
6b533d3 to
bc39466
Compare
|
Hi @hashhar. Just a gentle reminder on this PR in case you forgot. Thank you! |
fab19d4 to
2074032
Compare
9c548c3 to
819ddd9
Compare
819ddd9 to
7948bc4
Compare
|
This pull request has gone a while without any activity. Ask for help on #core-dev on Trino slack. |
|
Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time. |
|
@piotrrzysko @hashhar @lukasz-stec @wendigo Could I get a review here? |
core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/resourcegroups/ResourceGroup.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
...gers/src/main/resources/db/migration/mysql/V8__add_physical_data_scan_to_resource_groups.sql
Outdated
Show resolved
Hide resolved
df31081 to
24e79c7
Compare
448d088 to
27d4fab
Compare
| } | ||
|
|
||
| @Test | ||
| public void testMigrationWithOldResourceGroupsSchema() |
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.
I removed this test as it is not compatible with the new constraint. I feel this test is unnecessary.
I'm not sure why only this MySQL test supports old data during the migration. Postgres and Oracle tests do not have this test.
|
@lukasz-stec I have made the changes to support period-based tracking by adding a new property |
lukasz-stec
left a comment
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.
Looks good % minor comments
core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
| { | ||
| private final long cpuUsageMillis; | ||
| private final long memoryUsageBytes; | ||
| private final long physicalDataScanUsageBytes; |
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.
To be consistent with the source of this metric (getPhysicalInputDataSize), rename it please to something the has physicalInput in the name e.g. physicalInputDataUsageBytes or physicalInputUsageBytes. Here and everywhere else.
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.
Sounds good. All the internal references of the data usage now use physicalInputDataUsageBytes.
For the user exposed limits and quota period, those still have physical data scan in the naming which I think is fine. It is consistent with settings like query.max-scan-physical-bytes
core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java
Outdated
Show resolved
Hide resolved
xkrogen
left a comment
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.
Thanks for working on this feature, I think it's a great enhancement!
...trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroupManager.java
Outdated
Show resolved
Hide resolved
...source-group-managers/src/main/java/io/trino/plugin/resourcegroups/db/ResourceGroupsDao.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/server/ResourceGroupInfo.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java
Show resolved
Hide resolved
5c811c5 to
1509517
Compare
|
@xkrogen @lukasz-stec thanks for the review, i've addressed all the comments above |
lukasz-stec
left a comment
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.
...rs/src/main/java/io/trino/plugin/resourcegroups/db/ResourceGroupGlobalPropertiesReducer.java
Outdated
Show resolved
Hide resolved
Add physical data scan tracking to resource groups. This is an optional feature in resource groups that tracks data scan via quota based tracking.
1509517 to
2a9d9dd
Compare
| { | ||
| this.cpuUsageMillis = cpuUsageMillis; | ||
| this.memoryUsageBytes = memoryUsageBytes; | ||
| this.physicalInputDataUsageBytes = physicalInputDataUsageBytes; |
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.
nit: should we validate that these values are non-negative? (can be a follow up)
| private final long physicalInputDataUsageBytes; | ||
|
|
||
| public ResourceUsage(long cpuUsageMillis, long memoryUsageBytes) | ||
| public ResourceUsage(long cpuUsageMillis, long memoryUsageBytes, long physicalInputDataUsageBytes) |
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.
this could be converted to record class (can be a follow up)
Description
This PR adds support to track physical data scan usage in resource groups. This is an optional feature in resource groups and behaves similar to
cpuLimit. This is a helpful feature for admins who need to 'throttle' their users from pulling too much data from file system. Quota based tracking will penalize users accordingly.Additional context and related issues
#25003
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: