alloc memory for every operator in ENABLE_DEBUG_LOG mode to trace close && destroy
This commit is contained in:
committed by
ob-robot
parent
5cee718006
commit
1866ba4ce3
@ -528,6 +528,10 @@ ObOperator::ObOperator(ObExecContext &exec_ctx, const ObOpSpec &spec, ObOpInput
|
||||
batch_reach_end_(false),
|
||||
row_reach_end_(false),
|
||||
output_batches_b4_rescan_(0),
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
dummy_mem_context_(nullptr),
|
||||
dummy_ptr_(nullptr),
|
||||
#endif
|
||||
check_stack_overflow_(false)
|
||||
{
|
||||
eval_ctx_.max_batch_size_ = spec.max_batch_size_;
|
||||
@ -695,7 +699,17 @@ int ObOperator::open()
|
||||
LOG_WARN("init evaluate flags failed", K(ret));
|
||||
} else if (OB_FAIL(init_skip_vector())) {
|
||||
LOG_WARN("init skip vector failed", K(ret));
|
||||
} else if (OB_FAIL(inner_open())) {
|
||||
}
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
else if (OB_FAIL(init_dummy_mem_context(ctx_.get_my_session()->get_effective_tenant_id()))) {
|
||||
LOG_WARN("failed to get mem context", K(ret));
|
||||
} else if (OB_LIKELY(nullptr == dummy_ptr_)
|
||||
&& OB_ISNULL(dummy_ptr_ = static_cast<char *>(dummy_mem_context_->get_malloc_allocator().alloc(sizeof(char))))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("failed to alloc memory", K(ret));
|
||||
}
|
||||
#endif
|
||||
else if (OB_FAIL(inner_open())) {
|
||||
if (OB_TRY_LOCK_ROW_CONFLICT != ret && OB_TRANSACTION_SET_VIOLATION != ret) {
|
||||
LOG_WARN("Open this operator failed", K(ret), "op_type", op_name());
|
||||
}
|
||||
@ -955,6 +969,14 @@ int ObOperator::close()
|
||||
}
|
||||
IGNORE_RETURN submit_op_monitor_node();
|
||||
IGNORE_RETURN setup_op_feedback_info();
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
if (nullptr != dummy_mem_context_) {
|
||||
if (nullptr != dummy_ptr_) {
|
||||
dummy_mem_context_->get_malloc_allocator().free(dummy_ptr_);
|
||||
dummy_ptr_ = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1446,6 +1468,25 @@ inline int ObOperator::get_next_row_vectorizely()
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
inline int ObOperator::init_dummy_mem_context(uint64_t tenant_id)
|
||||
{
|
||||
int ret = common::OB_SUCCESS;
|
||||
if (OB_LIKELY(NULL == dummy_mem_context_)) {
|
||||
lib::ContextParam param;
|
||||
param.set_properties(lib::USE_TL_PAGE_OPTIONAL)
|
||||
.set_mem_attr(tenant_id, "ObSqlOp",
|
||||
common::ObCtxIds::DEFAULT_CTX_ID);
|
||||
if (OB_FAIL(CURRENT_CONTEXT->CREATE_CONTEXT(dummy_mem_context_, param))) {
|
||||
SQL_ENG_LOG(WARN, "create entity failed", K(ret));
|
||||
} else if (OB_ISNULL(dummy_mem_context_)) {
|
||||
SQL_ENG_LOG(WARN, "mem entity is null", K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ObBatchRowIter::get_next_row()
|
||||
{
|
||||
const int64_t max_row_cnt = INT64_MAX;
|
||||
|
||||
Reference in New Issue
Block a user