[CP] Fix the problem of still performing hard parsing when the SQL current limit reaches 0

This commit is contained in:
obdev
2023-12-07 11:43:21 +00:00
committed by ob-robot
parent 655c8c0790
commit 121cb80b19
4 changed files with 23 additions and 5 deletions

View File

@ -386,7 +386,8 @@ struct ObPlanCacheCtx : public ObILibCacheCtx
dynamic_param_info_list_(allocator),
tpl_sql_const_cons_(allocator),
need_retry_add_plan_(true),
insert_batch_opt_info_(allocator)
insert_batch_opt_info_(allocator),
is_max_curr_limit_(false)
{
fp_result_.pc_key_.mode_ = mode_;
}
@ -459,7 +460,8 @@ struct ObPlanCacheCtx : public ObILibCacheCtx
K(is_original_ps_mode_),
K(new_raw_sql_),
K(need_retry_add_plan_),
K(insert_batch_opt_info_)
K(insert_batch_opt_info_),
K(is_max_curr_limit_)
);
PlanCacheMode mode_; //control use which variables to do match
@ -521,6 +523,7 @@ struct ObPlanCacheCtx : public ObILibCacheCtx
// when schema version of cache node is old, whether remove this node and retry add cache obj.
bool need_retry_add_plan_;
ObInsertBatchOptInfo insert_batch_opt_info_;
bool is_max_curr_limit_;
};
struct ObPlanCacheStat

View File

@ -1206,7 +1206,18 @@ int ObSqlPlanSet::add_plan(ObPhysicalPlan &plan,
candi_table_locs))) {
LOG_WARN("fail to get physical locations", K(ret));
} else if (OB_FAIL(set_concurrent_degree(outline_param_idx, plan))) {
LOG_WARN("fail to check concurrent degree", K(ret));
if (OB_REACH_MAX_CONCURRENT_NUM == ret && 0 == plan.get_max_concurrent_num()) {
pc_ctx.is_max_curr_limit_ = true;
ret = OB_SUCCESS;
} else {
LOG_WARN("fail to check concurrent degree", K(ret));
}
} else {
// do nothing
}
if (OB_FAIL(ret)) {
// do nothing
} else {
if (pc_ctx.exec_ctx_.get_physical_plan_ctx()->get_or_expand_transformed()) {
need_try_plan_ |= TRY_PLAN_OR_EXPAND;
@ -1308,7 +1319,6 @@ int ObSqlPlanSet::add_plan(ObPhysicalPlan &plan,
// }
// }
}
return ret;
}