-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](counters) fix MemoryUsage and PeakMemoryUsage counters of some operators #41602
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
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
5021271 to
5fa6ca1
Compare
|
run buildall |
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.
clang-tidy made some suggestions
be/src/pipeline/exec/operator.cpp
Outdated
| PipelineXLocalStateBase::PipelineXLocalStateBase(RuntimeState* state, OperatorXBase* parent) | ||
| : _num_rows_returned(0), | ||
| _rows_returned_counter(nullptr), | ||
| : _rows_returned_counter(nullptr), |
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.
warning: member initializer for '_rows_returned_counter' is redundant [modernize-use-default-member-init]
| : _rows_returned_counter(nullptr), | |
| : , |
69f6048 to
3fe3a78
Compare
|
run buildall |
|
TeamCity be ut coverage result: |
| data.get_buffer_size_in_bytes() - | ||
| Base::_shared_state->mem_usage_record.used_in_state); | ||
| Base::_shared_state->mem_usage_record.used_in_state; | ||
| Base::_mem_tracker->consume(arena_memory_usage); |
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.
base 里的这个memtracker 还有用么?
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.
有了MemoryUsage和MemoryUsagePeak这两个counter,这个_mem_tracker感觉可以删掉了。
| local_state._memory_used_counter->set(local_state._mem_tracker->consumption()); | ||
| local_state._peak_memory_usage_counter->set( | ||
| local_state._mem_tracker->peak_consumption()); | ||
| COUNTER_SET(local_state._build_blocks_memory_usage, (int64_t)new_block_mem_usage); |
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.
至少跟580 行一致
| } | ||
| if (request.block_holder->get_block()) { | ||
| _parent->memory_used_counter()->update( | ||
| -request.block_holder->get_block()->ByteSizeLong()); |
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.
broadcast 的时候,是shared ptr,一个block 在多个channel 共享的,你这么统计,结果很大。
先别统计broadcast的了。
| RETURN_IF_ERROR( | ||
| BeExecVersionManager::check_be_exec_version(request.block->be_exec_version())); | ||
| } | ||
| _parent->memory_used_counter()->update(request.block->ByteSizeLong()); |
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.
我们 exchange sink operator:
- 先只统计非broad cast 方式的内存,统计方式跟现在这个PR的代码一样。
- channel 内保存的那一个block的内存。 broadcast方式的正好没有。
- 对于broadcast 方式的内存,可能是通过那个holder,构造和析构函数里计算,或者直接使用holder limiter的那个值。
0b594f4 to
1255d5a
Compare
|
run buildall |
|
TeamCity be ut coverage result: |
275528a to
ac364bb
Compare
|
run buildall |
|
TeamCity be ut coverage result: |
|
run p0 |
| Base::_mem_tracker->consume(arena_memory_usage); | ||
| _serialize_key_arena_memory_usage->add(arena_memory_usage); | ||
| Base::_shared_state->mem_usage_record.used_in_arena = _agg_arena_pool->size(); | ||
| int64_t arena_memory_usage = _agg_arena_pool->size(); |
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.
lost agg hash table?
| RuntimeProfile::Counter* _serialize_data_timer = nullptr; | ||
| RuntimeProfile::Counter* _deserialize_data_timer = nullptr; | ||
| RuntimeProfile::Counter* _max_row_size_counter = nullptr; | ||
| RuntimeProfile::Counter* _hash_table_memory_usage = nullptr; |
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 counter is not updated?
| SCOPED_TIMER(local_state._split_block_hash_compute_timer); | ||
| RETURN_IF_ERROR( | ||
| local_state._partitioner->do_partitioning(state, block, _mem_tracker.get())); | ||
| RETURN_IF_ERROR(local_state._partitioner->do_partitioning(state, block, nullptr)); |
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.
why add a nullptr not remove this parameter?
be/src/pipeline/exec/operator.cpp
Outdated
|
|
||
| if (auto rows = block->rows()) { | ||
| _num_rows_returned += rows; | ||
| COUNTER_UPDATE(_rows_returned_counter, rows); |
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.
这里统一给加了,然后每个operator 内部也在加,难道没有错吗?
| vectorized::Block::filter_block_internal(block, _shared_state->need_computes); | ||
| if (auto rows = block->rows()) { | ||
| _num_rows_returned += rows; | ||
| add_num_rows_returned(rows); |
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.
这里也加,然后base 里也加?
| { | ||
| SCOPED_TIMER(_partition_timer); | ||
| (void)_partitioner->do_partitioning(state, &sub_block, _mem_tracker.get()); | ||
| (void)_partitioner->do_partitioning(state, &sub_block, nullptr); |
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.
这里的nullptr 有啥意义吗?
ac364bb to
d9ef85e
Compare
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
|
clang-tidy review says "All clean, LGTM! 👍" |
|
TeamCity be ut coverage result: |
|
run buildall |
|
TeamCity be ut coverage result: |
mrhhsg
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.
lgtm
…operators (apache#41602) ## Proposed changes Issue Number: close #xxx <!--Describe your changes.-->
…ize when EOF. (#47312) ### What problem does this PR solve? #41602 EOF clears _instance_to_package_queue but does not update total_queue_size, causing incorrect judgments that rely on total_queue_size. UT ``` mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :2 mock transmit_blockv2 dest ins id :3 queue size : 6 each queue size : Instance: 2, queue size: 2 Instance: 1, queue size: 2 Instance: 3, queue size: 2 queue size : 6 // error size each queue size : Instance: 2, queue size: 0 Instance: 1, queue size: 2 Instance: 3, queue size: 2 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :3 mock transmit_blockv2 dest ins id :3 ```
…ize when EOF. (apache#47312) apache#41602 EOF clears _instance_to_package_queue but does not update total_queue_size, causing incorrect judgments that rely on total_queue_size. UT ``` mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :2 mock transmit_blockv2 dest ins id :3 queue size : 6 each queue size : Instance: 2, queue size: 2 Instance: 1, queue size: 2 Instance: 3, queue size: 2 queue size : 6 // error size each queue size : Instance: 2, queue size: 0 Instance: 1, queue size: 2 Instance: 3, queue size: 2 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :3 mock transmit_blockv2 dest ins id :3 ```
…ize when EOF. (#47312) (#47621) #41602 EOF clears _instance_to_package_queue but does not update total_queue_size, causing incorrect judgments that rely on total_queue_size. UT ``` mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :2 mock transmit_blockv2 dest ins id :3 queue size : 6 each queue size : Instance: 2, queue size: 2 Instance: 1, queue size: 2 Instance: 3, queue size: 2 queue size : 6 // error size each queue size : Instance: 2, queue size: 0 Instance: 1, queue size: 2 Instance: 3, queue size: 2 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :3 mock transmit_blockv2 dest ins id :3 ``` ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> Co-authored-by: Mryange <yanxuecheng@selectdb.com>
…ize when EOF. (#47322) ### What problem does this PR solve? pick part from #47312 #41602 EOF clears _instance_to_package_queue but does not update total_queue_size, causing incorrect judgments that rely on total_queue_size. UT ``` mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :2 mock transmit_blockv2 dest ins id :3 queue size : 6 each queue size : Instance: 2, queue size: 2 Instance: 1, queue size: 2 Instance: 3, queue size: 2 queue size : 6 // error size each queue size : Instance: 2, queue size: 0 Instance: 1, queue size: 2 Instance: 3, queue size: 2 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :3 mock transmit_blockv2 dest ins id :3 ```
…ize when EOF. (apache#47312) ### What problem does this PR solve? apache#41602 EOF clears _instance_to_package_queue but does not update total_queue_size, causing incorrect judgments that rely on total_queue_size. UT ``` mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :2 mock transmit_blockv2 dest ins id :3 queue size : 6 each queue size : Instance: 2, queue size: 2 Instance: 1, queue size: 2 Instance: 3, queue size: 2 queue size : 6 // error size each queue size : Instance: 2, queue size: 0 Instance: 1, queue size: 2 Instance: 3, queue size: 2 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :3 mock transmit_blockv2 dest ins id :3 ```
…ize when EOF. (apache#47312) ### What problem does this PR solve? apache#41602 EOF clears _instance_to_package_queue but does not update total_queue_size, causing incorrect judgments that rely on total_queue_size. UT ``` mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :2 mock transmit_blockv2 dest ins id :3 queue size : 6 each queue size : Instance: 2, queue size: 2 Instance: 1, queue size: 2 Instance: 3, queue size: 2 queue size : 6 // error size each queue size : Instance: 2, queue size: 0 Instance: 1, queue size: 2 Instance: 3, queue size: 2 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :1 mock transmit_blockv2 dest ins id :3 mock transmit_blockv2 dest ins id :3 ```
Proposed changes
Issue Number: close #xxx