Fix exec context implicit 500 tenant memory usage

This commit is contained in:
obdev
2023-10-16 12:10:11 +00:00
committed by ob-robot
parent 1640e582e0
commit a4aff412c8
2 changed files with 3 additions and 5 deletions

View File

@ -688,6 +688,9 @@ inline void ObExecContext::reference_my_plan(const ObPhysicalPlan *my_plan)
inline void ObExecContext::set_my_session(ObSQLSessionInfo *session) inline void ObExecContext::set_my_session(ObSQLSessionInfo *session)
{ {
my_session_ = session; my_session_ = session;
set_mem_attr(ObMemAttr(session->get_effective_tenant_id(),
ObModIds::OB_SQL_EXEC_CONTEXT,
ObCtxIds::EXECUTE_CTX_ID));
} }
inline ObSQLSessionInfo *ObExecContext::get_my_session() const inline ObSQLSessionInfo *ObExecContext::get_my_session() const

View File

@ -3726,12 +3726,7 @@ OB_INLINE int ObSql::init_exec_context(const ObSqlCtx &context, ObExecContext &e
if (OB_FAIL(exec_ctx.create_physical_plan_ctx())) { if (OB_FAIL(exec_ctx.create_physical_plan_ctx())) {
LOG_WARN("faile to create physical plan ctx", K(ret)); LOG_WARN("faile to create physical plan ctx", K(ret));
} else { } else {
ObMemAttr mem_attr;
mem_attr.label_ = ObModIds::OB_SQL_EXEC_CONTEXT;
mem_attr.tenant_id_ = context.session_info_->get_effective_tenant_id();
mem_attr.ctx_id_ = ObCtxIds::EXECUTE_CTX_ID;
exec_ctx.set_my_session(context.session_info_); exec_ctx.set_my_session(context.session_info_);
exec_ctx.set_mem_attr(mem_attr);
exec_ctx.set_sql_ctx(const_cast<ObSqlCtx*>(&context)); exec_ctx.set_sql_ctx(const_cast<ObSqlCtx*>(&context));
if (OB_NOT_NULL(exec_ctx.get_physical_plan_ctx()) && OB_NOT_NULL(context.session_info_)) { if (OB_NOT_NULL(exec_ctx.get_physical_plan_ctx()) && OB_NOT_NULL(context.session_info_)) {
int64_t query_timeout = 0; int64_t query_timeout = 0;