[feature] (memory) Switch TLS mem tracker to separate more detailed memory usage (#8605)
In pr #8476, all memory usage of a process is recorded in the process mem tracker, and all memory usage of a query is recorded in the query mem tracker, and it is still necessary to manually call `transfer to` to track the cached memory size. We hope to separate out more detailed memory usage based on Hook TCMalloc new/delete + TLS mem tracker. In this pr, the more detailed mem tracker is switched to TLS, which automatically and accurately counts more detailed memory usage than before.
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
#include "exec/exec_node.h"
|
||||
#include "runtime/mem_pool.h"
|
||||
#include "runtime/row_batch.h"
|
||||
#include "runtime/thread_context.h"
|
||||
#include "util/defer_op.h"
|
||||
#include "vec/core/block.h"
|
||||
#include "vec/data_types/data_type_nullable.h"
|
||||
@ -332,6 +333,7 @@ Status AggregationNode::prepare(RuntimeState* state) {
|
||||
|
||||
Status AggregationNode::open(RuntimeState* state) {
|
||||
RETURN_IF_ERROR(ExecNode::open(state));
|
||||
SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_ERR_CB("aggregator, while execute open.");
|
||||
SCOPED_TIMER(_runtime_profile->total_time_counter());
|
||||
|
||||
RETURN_IF_ERROR(VExpr::open(_probe_expr_ctxs, state));
|
||||
@ -356,7 +358,6 @@ Status AggregationNode::open(RuntimeState* state) {
|
||||
}
|
||||
RETURN_IF_ERROR(_executor.execute(&block));
|
||||
_executor.update_memusage();
|
||||
RETURN_IF_INSTANCE_LIMIT_EXCEEDED(state, "aggregator, while execute open.");
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
@ -366,7 +367,9 @@ Status AggregationNode::get_next(RuntimeState* state, RowBatch* row_batch, bool*
|
||||
return Status::NotSupported("Not Implemented Aggregation Node::get_next scalar");
|
||||
}
|
||||
|
||||
Status AggregationNode::get_next(RuntimeState* state, Block* block, bool* eos) { SCOPED_TIMER(_runtime_profile->total_time_counter());
|
||||
Status AggregationNode::get_next(RuntimeState* state, Block* block, bool* eos) {
|
||||
SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_ERR_CB("aggregator, while execute get_next.");
|
||||
SCOPED_TIMER(_runtime_profile->total_time_counter());
|
||||
|
||||
if (_is_streaming_preagg) {
|
||||
bool child_eos = false;
|
||||
@ -395,7 +398,6 @@ Status AggregationNode::get_next(RuntimeState* state, Block* block, bool* eos) {
|
||||
}
|
||||
|
||||
_executor.update_memusage();
|
||||
RETURN_IF_INSTANCE_LIMIT_EXCEEDED(state, "aggregator, while execute get_next.");
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user