Fix memory consumption when max_block_size is huge in Aggregator + more memory checks#51566
Merged
nickitat merged 9 commits intoClickHouse:masterfrom Aug 2, 2023
Merged
Conversation
Contributor
|
This is an automated comment for commit a494951 with description of existing statuses. It's updated for the latest CI running
|
Member
Author
e4cfffa to
137263c
Compare
nickitat
commented
Jul 5, 2023
| /// - No two-level aggregation | ||
| /// - No external aggregation | ||
| /// - No without_key support (it is implemented using executeOnIntervalWithoutKey()) | ||
| void executeOnBlockSmall( |
Member
Author
There was a problem hiding this comment.
I'm not sure why this methods were in private section since they're used in AggregatingInOrderTransform
nickitat
commented
Jul 5, 2023
| * So, we allow over-allocations. | ||
| */ | ||
| Int64 will_be = size + amount.fetch_add(size, std::memory_order_relaxed); | ||
| Int64 will_be = size ? size + amount.fetch_add(size, std::memory_order_relaxed) : amount.load(std::memory_order_relaxed); |
Member
Author
There was a problem hiding this comment.
rmw atomics are really expensive, this way check() that does alloc(0) will be much cheaper.
max_block_size is huge in Aggregatormax_block_size is huge in Aggregator + more memory checks
alexey-milovidov
approved these changes
Jul 5, 2023
| -- this is what allows mem usage to go really high | ||
| set max_block_size=10000000000; | ||
|
|
||
| set max_memory_usage_for_user = '1Gi'; |
Member
There was a problem hiding this comment.
Why "for user"?
It prevents running the test in parallel.
Member
|
@nickitat one integration test looks suspicious. |
Member
Author
this test is flaky |
25 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed memory consumption in
Aggregatorwhenmax_block_sizeis huge.Fixes: #48173