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

[WIP][Enhancement] Try catch the memory alloc of Aggregator::compute_batch_agg_states #55382

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

trueeyu
Copy link
Contributor

@trueeyu trueeyu commented Jan 23, 2025

Why I'm doing:

For multi_distinct_count or some other array aggr function, deserialize_and_merge may allocate a large amount of memory at once, sometimes it causes BE oom, so we better use theTRY_CATCH_BAD_ALLOC to ensure that memory is checked first and then allocate.

W0819 19:43:47.005649 51862 mem_hook.cpp:253] large memory alloc, is_catched: 0 query_id:3922a21c-5e20-11ef-950b-00163e3e1da6 instance: 3922a21c-5e20-11ef-950b-00163e3e1dd8 acquire:1677721592 bytes, stack:
    @          0x2b45f1b  malloc
    @          0x831a1e5  operator new()
    @          0x39869cd  phmap::priv::raw_hash_set<>::resize()
    @          0x3986ed3  phmap::priv::raw_hash_set<>::prepare_insert()
    @          0x41539e6  starrocks::DistinctAggregateState<>::deserialize_and_merge()
    @          0x4153c01  starrocks::TDistinctAggregateFunction<>::merge()
    @          0x4092814  starrocks::NullableAggregateFunctionUnary<>::merge_batch()
    @          0x372e50c  starrocks::Aggregator::compute_batch_agg_states()
    @          0x36367a5  starrocks::pipeline::AggregateBlockingSinkOperator::push_chunk()
    @          0x3602123  starrocks::pipeline::PipelineDriver::process()
    @          0x35f3cee  starrocks::pipeline::GlobalDriverExecutor::_worker_thread()
    @          0x2c1488c  starrocks::ThreadPool::dispatch_thread()
    @          0x2c0e50a  starrocks::Thread::supervise_thread()
    @     0x7fcf28782ea5  start_thread
    @     0x7fcf284abb0d  __clone
    @              (nil)  (unknown)

What I'm doing:

Try catch the memory alloc of Aggregator::compute_batch_agg_states

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@trueeyu trueeyu requested a review from a team as a code owner January 23, 2025 11:50
@github-actions github-actions bot added the 3.4 label Jan 23, 2025
Signed-off-by: trueeyu <[email protected]>
@trueeyu trueeyu changed the title [Enhancement] Try catch the memory alloc of Aggregator::compute_batch_agg_states [WIP][Enhancement] Try catch the memory alloc of Aggregator::compute_batch_agg_states Jan 23, 2025
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

fail : 15 / 35 (42.86%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/aggregate/aggregate_blocking_node.cpp 0 2 00.00% [88, 110]
🔵 be/src/exec/aggregate/aggregate_streaming_node.cpp 0 11 00.00% [86, 87, 94, 95, 122, 123, 130, 131, 135, 139, 161]
🔵 be/src/exec/pipeline/aggregate/aggregate_streaming_sink_operator.cpp 6 11 54.55% [117, 126, 129, 157, 198]
🔵 be/src/exec/pipeline/aggregate/spillable_aggregate_blocking_sink_operator.cpp 5 7 71.43% [204, 246]
🔵 be/src/exec/pipeline/aggregate/aggregate_blocking_sink_operator.cpp 4 4 100.00% []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants