From 8958d59bf2c44d3ac72c99dcb672e4be635f8a25 Mon Sep 17 00:00:00 2001 From: bx0 Date: Thu, 14 Apr 2022 11:20:50 +0800 Subject: [PATCH] sql_id is null when hit plan cache. --- src/sql/plan_cache/ob_plan_cache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sql/plan_cache/ob_plan_cache.cpp b/src/sql/plan_cache/ob_plan_cache.cpp index 3a7d2a47e6..f2bff32083 100644 --- a/src/sql/plan_cache/ob_plan_cache.cpp +++ b/src/sql/plan_cache/ob_plan_cache.cpp @@ -396,7 +396,8 @@ int ObPlanCache::get_plan( if (OB_SUCC(ret)) { plan = static_cast(cache_obj); - MEMCPY(pc_ctx.sql_ctx_.sql_id_, plan->stat_.bl_info_.sql_id_.ptr(), plan->stat_.bl_info_.sql_id_.length()); + const ObString &plan_stat_sql_id = plan->stat_.sql_id_; + MEMCPY(pc_ctx.sql_ctx_.sql_id_, plan_stat_sql_id.ptr(), plan_stat_sql_id.length()); uint64_t tenant_id = pc_ctx.sql_ctx_.session_info_->get_effective_tenant_id(); bool read_only = false; if (OB_FAIL(pc_ctx.sql_ctx_.schema_guard_->get_tenant_read_only(tenant_id, read_only))) { @@ -1568,8 +1569,8 @@ int ObPlanCache::get_ps_plan( if (OB_SUCC(ret)) { if (cache_obj->is_sql_crsr()) { ObPhysicalPlan *sql_plan = static_cast(cache_obj); - MEMCPY( - pc_ctx.sql_ctx_.sql_id_, sql_plan->stat_.bl_info_.sql_id_.ptr(), sql_plan->stat_.bl_info_.sql_id_.length()); + const ObString &plan_stat_sql_id = sql_plan->stat_.sql_id_; + MEMCPY(pc_ctx.sql_ctx_.sql_id_, plan_stat_sql_id.ptr(), plan_stat_sql_id.length()); } } -- GitLab