[feature-wip] (memory tracker) (step4) Switch TLS mem tracker to separate more detailed memory usage (#8669)

Based on #8605, Separate out the memory usage of each operator from the Query/Load/StorageEngine mem tracker.
This commit is contained in:
Xinyi Zou
2022-04-08 09:02:26 +08:00
committed by GitHub
parent 7fb4b6a6e2
commit 519305cb22
79 changed files with 378 additions and 150 deletions

View File

@ -59,6 +59,7 @@ Status TopNNode::init(const TPlanNode& tnode, RuntimeState* state) {
Status TopNNode::prepare(RuntimeState* state) {
SCOPED_TIMER(_runtime_profile->total_time_counter());
RETURN_IF_ERROR(ExecNode::prepare(state));
SCOPED_SWITCH_TASK_THREAD_LOCAL_MEM_TRACKER(mem_tracker());
_tuple_pool.reset(new MemPool(mem_tracker().get()));
RETURN_IF_ERROR(_sort_exec_exprs.prepare(state, child(0)->row_desc(), _row_descriptor,
expr_mem_tracker()));
@ -75,6 +76,7 @@ Status TopNNode::prepare(RuntimeState* state) {
Status TopNNode::open(RuntimeState* state) {
SCOPED_TIMER(_runtime_profile->total_time_counter());
SCOPED_SWITCH_TASK_THREAD_LOCAL_MEM_TRACKER(mem_tracker());
RETURN_IF_ERROR(ExecNode::open(state));
RETURN_IF_CANCELLED(state);
RETURN_IF_ERROR(state->check_query_state("Top n, before open."));
@ -127,6 +129,7 @@ Status TopNNode::open(RuntimeState* state) {
Status TopNNode::get_next(RuntimeState* state, RowBatch* row_batch, bool* eos) {
SCOPED_TIMER(_runtime_profile->total_time_counter());
SCOPED_SWITCH_TASK_THREAD_LOCAL_EXISTED_MEM_TRACKER(mem_tracker());
RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::GETNEXT));
RETURN_IF_CANCELLED(state);
RETURN_IF_ERROR(state->check_query_state("Top n, before moving result to row_batch."));