fix sql executor use memory of 500 tenant
This commit is contained in:
		| @ -392,6 +392,9 @@ int ObMPStmtFetch::response_result(pl::ObPLCursorInfo &cursor, | ||||
|               } | ||||
|             } else { | ||||
|               tmp_exec_ctx.set_my_session(&session); | ||||
|               tmp_exec_ctx.set_mem_attr(ObMemAttr(session.get_effective_tenant_id(), | ||||
|                                                   ObModIds::OB_SQL_EXEC_CONTEXT, | ||||
|                                                   ObCtxIds::EXECUTE_CTX_ID)); | ||||
|               exec_ctx = &tmp_exec_ctx; | ||||
|               if (OB_ISNULL(cursor.get_spi_cursor())) { | ||||
|                 ret = OB_ERR_UNEXPECTED; | ||||
|  | ||||
| @ -267,6 +267,9 @@ int ObExprMinus::calc(ObDatum &res, const ObDatum &left, const ObDatum &right, | ||||
|         OZ (plan_ctx.init_datum_param_store()); | ||||
|         OX (exec_ctx.set_physical_plan_ctx(&plan_ctx)); | ||||
|         OX (exec_ctx.set_my_session(&default_session)); | ||||
|         OX (exec_ctx.set_mem_attr(ObMemAttr(tenant_id, | ||||
|                                             ObModIds::OB_SQL_EXEC_CONTEXT, | ||||
|                                             ObCtxIds::EXECUTE_CTX_ID))); | ||||
|         OX (arith = OB_NEWx(ObRTDatumArith, allocator, exec_ctx, default_session)); | ||||
|         if (OB_FAIL(ret)) { | ||||
|           if (NULL != arith) { | ||||
|  | ||||
| @ -40,9 +40,11 @@ int calc_digest_text(ObIAllocator &allocator, | ||||
|   int ret = OB_SUCCESS; | ||||
|   ObArenaAllocator temp_allocator(ObModIds::OB_SQL_EXPR_CALC); | ||||
|   HEAP_VAR(ObExecContext, exec_ctx, temp_allocator) { | ||||
|     uint64_t tenant_id = session->get_effective_tenant_id(); | ||||
|     ObPhysicalPlanCtx phy_plan_ctx(allocator); | ||||
|     exec_ctx.set_physical_plan_ctx(&phy_plan_ctx); | ||||
|     exec_ctx.set_my_session(session); | ||||
|     exec_ctx.set_mem_attr(ObMemAttr(tenant_id, ObModIds::OB_SQL_EXEC_CONTEXT, ObCtxIds::EXECUTE_CTX_ID)); | ||||
|     ObSqlCtx sql_ctx; | ||||
|     sql_ctx.session_info_ = session; | ||||
|     sql_ctx.schema_guard_ = schema_guard; | ||||
|  | ||||
| @ -168,6 +168,8 @@ int ObRemoteBaseExecuteP<T>::base_before_process(int64_t tenant_schema_version, | ||||
|     exec_ctx_.set_my_session(session_info); | ||||
|     exec_ctx_.show_session(); | ||||
|     exec_ctx_.get_sql_ctx()->session_info_ = session_info; | ||||
|     exec_ctx_.set_mem_attr(ObMemAttr(tenant_id, ObModIds::OB_SQL_EXEC_CONTEXT, ObCtxIds::EXECUTE_CTX_ID)); | ||||
|  | ||||
|     vt_ctx.session_ = session_info; | ||||
|     vt_ctx.vt_iter_factory_ = &vt_iter_factory_; | ||||
|     vt_ctx.schema_guard_ = &schema_guard_; | ||||
|  | ||||
| @ -669,6 +669,9 @@ int ObSQLUtils::se_calc_const_expr(ObSQLSessionInfo *session, | ||||
|                     (NULL != out_ctx ? out_ctx->get_min_cluster_version() : GET_MIN_CLUSTER_VERSION()))) { | ||||
|         LinkExecCtxGuard link_guard(*session, exec_ctx); | ||||
|         exec_ctx.set_my_session(session); | ||||
|         exec_ctx.set_mem_attr(ObMemAttr(session->get_effective_tenant_id(), | ||||
|                                         ObModIds::OB_SQL_EXEC_CONTEXT, | ||||
|                                         ObCtxIds::EXECUTE_CTX_ID)); | ||||
|         exec_ctx.set_physical_plan_ctx(&phy_plan_ctx); | ||||
|         if (NULL != out_ctx) { | ||||
|           exec_ctx.set_sql_ctx(out_ctx->get_sql_ctx()); | ||||
| @ -903,6 +906,9 @@ int ObSQLUtils::make_default_expr_context(uint64_t tenant_id, ObIAllocator &allo | ||||
|     } else { | ||||
|       exec_ctx = new(exec_ctx)ObExecContext(allocator); | ||||
|       exec_ctx->set_my_session(default_session); | ||||
|       exec_ctx->set_mem_attr(ObMemAttr(tenant_id, | ||||
|                                        ObModIds::OB_SQL_EXEC_CONTEXT, | ||||
|                                        ObCtxIds::EXECUTE_CTX_ID)); | ||||
|       expr_ctx.exec_ctx_ = exec_ctx; | ||||
|       expr_ctx.exec_ctx_->set_my_session(default_session); | ||||
|     } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 obdev
					obdev