fix baseline key changed by get pl function

This commit is contained in:
obdev
2022-11-29 10:04:11 +00:00
committed by ob-robot
parent d137b6ba00
commit 1c07891380
2 changed files with 5 additions and 3 deletions

View File

@ -1563,6 +1563,7 @@ int ObPL::get_pl_function(ObExecContext &ctx,
OZ (ObPLContext::valid_execute_context(ctx));
if (OB_SUCC(ret)) {
ObPlanCache *plan_cache = ctx.get_my_session()->get_plan_cache();
ObPlanBaseKeyGuard guard(ctx.get_sql_ctx()->spm_ctx_.bl_key_);
ObPlanCacheCtx pc_ctx(sql,
true, // PS_MODE
ctx.get_allocator(),
@ -1691,6 +1692,7 @@ int ObPL::get_pl_function(ObExecContext &ctx,
} else { // standalone routine
static const ObString PLSQL = ObString("PL/SQL");
ObPlanCache *plan_cache = ctx.get_my_session()->get_plan_cache();
ObPlanBaseKeyGuard guard(ctx.get_sql_ctx()->spm_ctx_.bl_key_);
ObPlanCacheCtx pc_ctx(PLSQL,
false, // ps mode
ctx.get_allocator(),

View File

@ -61,9 +61,9 @@ class ObResultSet;
class ObPlanBaseKeyGuard
{
public:
explicit ObPlanBaseKeyGuard(ObBaselineKey &bl_key)
: bl_key_(bl_key),
ori_bl_key_(bl_key) {}
[[nodiscard]] explicit ObPlanBaseKeyGuard(ObBaselineKey &bl_key)
: bl_key_(bl_key),
ori_bl_key_(bl_key) {}
~ObPlanBaseKeyGuard()
{
bl_key_ = ori_bl_key_;