[CP] Fix the problem of still performing hard parsing when the SQL current limit reaches 0
This commit is contained in:
parent
655c8c0790
commit
121cb80b19
@ -692,7 +692,9 @@ int ObPhysicalPlan::inc_concurrent_num()
|
||||
} else {
|
||||
while(OB_SUCC(ret) && false == is_succ) {
|
||||
concurrent_num = ATOMIC_LOAD(&concurrent_num_);
|
||||
if (concurrent_num >= max_concurrent_num_) {
|
||||
if (0 == max_concurrent_num_) {
|
||||
ret = OB_REACH_MAX_CONCURRENT_NUM;
|
||||
} else if (concurrent_num >= max_concurrent_num_) {
|
||||
ret = OB_REACH_MAX_CONCURRENT_NUM;
|
||||
} else {
|
||||
new_num = concurrent_num + 1;
|
||||
|
@ -4329,6 +4329,9 @@ int ObSql::pc_add_plan(ObPlanCacheCtx &pc_ctx,
|
||||
ret = plan_cache->add_plan(phy_plan, pc_ctx);
|
||||
}
|
||||
plan_added = (OB_SUCCESS == ret);
|
||||
if (pc_ctx.is_max_curr_limit_) {
|
||||
ret = OB_REACH_MAX_CONCURRENT_NUM;
|
||||
}
|
||||
|
||||
if (is_batch_exec) {
|
||||
// Batch optimization cannot continue for errors other than OB_SQL_PC_PLAN_DUPLICATE.
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user