[enhancement] Refactor to improve the usability of MemTracker (step2) (#10823)

This commit is contained in:
Xinyi Zou
2022-07-21 17:11:28 +08:00
committed by GitHub
parent 5f6f35e886
commit 4960043f5e
316 changed files with 2145 additions and 4369 deletions

View File

@ -35,14 +35,14 @@ SelectNode::SelectNode(ObjectPool* pool, const TPlanNode& tnode, const Descripto
Status SelectNode::prepare(RuntimeState* state) {
RETURN_IF_ERROR(ExecNode::prepare(state));
SCOPED_SWITCH_TASK_THREAD_LOCAL_MEM_TRACKER(mem_tracker());
SCOPED_CONSUME_MEM_TRACKER(mem_tracker());
_child_row_batch.reset(new RowBatch(child(0)->row_desc(), state->batch_size()));
return Status::OK();
}
Status SelectNode::open(RuntimeState* state) {
SCOPED_SWITCH_TASK_THREAD_LOCAL_MEM_TRACKER(mem_tracker());
RETURN_IF_ERROR(ExecNode::open(state));
SCOPED_CONSUME_MEM_TRACKER(mem_tracker());
RETURN_IF_ERROR(child(0)->open(state));
return Status::OK();
}
@ -50,7 +50,7 @@ Status SelectNode::open(RuntimeState* state) {
Status SelectNode::get_next(RuntimeState* state, RowBatch* row_batch, bool* eos) {
RETURN_IF_CANCELLED(state);
SCOPED_TIMER(_runtime_profile->total_time_counter());
SCOPED_SWITCH_TASK_THREAD_LOCAL_EXISTED_MEM_TRACKER(mem_tracker());
SCOPED_CONSUME_MEM_TRACKER(mem_tracker());
if (reached_limit() || (_child_row_idx == _child_row_batch->num_rows() && _child_eos)) {
// we're already done or we exhausted the last child batch and there won't be any