Fix core at plan cache ObCacheObject::pre_calculation
This commit is contained in:
parent
f51dd07dba
commit
9710bb145a
@ -86,6 +86,13 @@ ObPhysicalPlanCtx::ObPhysicalPlanCtx(common::ObIAllocator& allocator)
|
||||
ObPhysicalPlanCtx::~ObPhysicalPlanCtx()
|
||||
{}
|
||||
|
||||
void ObPhysicalPlanCtx::restore_param_store(const int64_t original_param_cnt)
|
||||
{
|
||||
for (int64_t i = param_store_.count(); i > original_param_cnt; --i) {
|
||||
param_store_.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
int ObPhysicalPlanCtx::reserve_param_space(int64_t param_count)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
{
|
||||
return consistency_level_;
|
||||
}
|
||||
void restore_param_store(const int64_t param_count);
|
||||
// param store
|
||||
int reserve_param_space(int64_t param_count);
|
||||
const ParamStore& get_param_store() const
|
||||
|
@ -1496,6 +1496,7 @@ int ObPlanCache::get_ps_plan(
|
||||
UNUSED(stmt_id);
|
||||
ObSqlTraits sql_traits;
|
||||
ObCacheObject* cache_obj = NULL;
|
||||
int64_t original_param_cnt = 0;
|
||||
pc_ctx.handle_id_ = ref_handle;
|
||||
if (OB_ISNULL(pc_ctx.sql_ctx_.session_info_) || OB_ISNULL(pc_ctx.sql_ctx_.schema_guard_) ||
|
||||
OB_ISNULL(pc_ctx.exec_ctx_.get_physical_plan_ctx())) {
|
||||
@ -1509,6 +1510,8 @@ int ObPlanCache::get_ps_plan(
|
||||
} else if (FALSE_IT(pc_ctx.fp_result_.cache_params_ =
|
||||
&(pc_ctx.exec_ctx_.get_physical_plan_ctx()->get_param_store_for_update()))) {
|
||||
// do nothing
|
||||
} else if (FALSE_IT(original_param_cnt = pc_ctx.fp_result_.cache_params_->count())) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(construct_plan_cache_key(pc_ctx, NS_CRSR))) {
|
||||
LOG_WARN("fail to construnct plan cache key", K(ret));
|
||||
} else if (OB_FAIL(get_cache_obj(pc_ctx, cache_obj))) {
|
||||
@ -1528,6 +1531,7 @@ int ObPlanCache::get_ps_plan(
|
||||
ObPsStmtId new_stmt_id = pc_ctx.fp_result_.pc_key_.key_id_;
|
||||
pc_ctx.fp_result_.pc_key_.key_id_ = OB_INVALID_ID;
|
||||
pc_ctx.fp_result_.pc_key_.name_ = pc_ctx.raw_sql_;
|
||||
pc_ctx.exec_ctx_.get_physical_plan_ctx()->restore_param_store(original_param_cnt);
|
||||
SQL_PC_LOG(
|
||||
DEBUG, "start to get plan by sql", K(new_stmt_id), K(pc_ctx.fp_result_.pc_key_), K(sql_pcvs_map_.size()));
|
||||
if (OB_FAIL(get_cache_obj(pc_ctx, cache_obj))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user