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

add memory limit for aggregations #1942

Merged
merged 3 commits into from
Mar 16, 2023
Merged

add memory limit for aggregations #1942

merged 3 commits into from
Mar 16, 2023

Conversation

PSeitz
Copy link
Contributor

@PSeitz PSeitz commented Mar 14, 2023

introduce AggregationLimits to set memory consumption limit and bucket limits
memory limit is checked during aggregation, bucket limit is checked before returning the aggregation request.

TODO: add check for term aggregation

@PSeitz PSeitz force-pushed the agg_memory_limit branch 2 times, most recently from ebabd4d to 1d305c5 Compare March 14, 2023 13:36
@PSeitz PSeitz requested a review from fulmicoton March 14, 2023 13:42
fn memory_consumption(&self) -> usize;
}

impl<K, V, S> MemoryConsumption for HashMap<K, V, S> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
impl<K, V, S> MemoryConsumption for HashMap<K, V, S> {
impl<K: Copy, V: Copy, S> MemoryConsumption for HashMap<K, V, S> {

#[error("Date histogram parse error: {0:?}")]
DateHistogramParseError(#[from] DateHistogramParseError),
/// Memory limit exceeded
#[error(
"Aborting aggregation because memory limit was exceeded. Limit: {limit:?}, Current: \
Copy link
Collaborator

Choose a reason for hiding this comment

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

that would be nice to display a value expressed in MB, with a unit.

Copy link
Contributor Author

@PSeitz PSeitz Mar 16, 2023

Choose a reason for hiding this comment

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

I changed the existing ByteCount to cover that

@@ -55,7 +55,7 @@ impl fmt::Debug for DataCorruption {
#[derive(Debug, Clone, Error)]
pub enum TantivyError {
/// Error when handling aggregations.
#[error("AggregationError {0:?}")]
#[error(transparent)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

ah cool ! I did not know about transparent

PSeitz and others added 2 commits March 15, 2023 15:52
introduce AggregationLimits to set memory consumption limit and bucket limits
memory limit is checked during aggregation, bucket limit is checked before returning the aggregation request.
Co-authored-by: Paul Masurel <paul@quickwit.io>
@codecov-commenter
Copy link

Codecov Report

Merging #1942 (09f1381) into main (b6703f1) will increase coverage by 0.00%.
The diff coverage is 97.72%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff            @@
##             main    #1942    +/-   ##
========================================
  Coverage   94.48%   94.48%            
========================================
  Files         309      311     +2     
  Lines       56999    57207   +208     
========================================
+ Hits        53855    54054   +199     
- Misses       3144     3153     +9     
Impacted Files Coverage Δ
common/src/lib.rs 91.91% <ø> (ø)
src/aggregation/error.rs 100.00% <ø> (ø)
src/error.rs 12.28% <ø> (ø)
src/fastfield/alive_bitset.rs 99.30% <ø> (ø)
src/fastfield/readers.rs 90.68% <66.66%> (ø)
src/aggregation/intermediate_agg_result.rs 96.96% <82.35%> (-0.98%) ⬇️
src/aggregation/mod.rs 93.73% <90.00%> (+0.12%) ⬆️
columnar/src/dynamic_column.rs 54.42% <100.00%> (ø)
common/src/bitset.rs 97.18% <100.00%> (ø)
common/src/byte_count.rs 100.00% <100.00%> (ø)
... and 16 more

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@PSeitz PSeitz merged commit 9e2faec into main Mar 16, 2023
@PSeitz PSeitz deleted the agg_memory_limit branch March 16, 2023 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants