fix distribute for-update material location allocate error

This commit is contained in:
ChangerR 2023-02-15 09:47:06 +00:00 committed by ob-robot
parent 43a9aeb34f
commit f98ab35d69
3 changed files with 12 additions and 14 deletions

View File

@ -12989,10 +12989,12 @@ int ObLogPlan::get_shared_expr(ObRawExpr *&expr)
return ret;
}
int ObLogPlan::candi_allocate_material()
// this function is used to allocate the material operator to the for-update operator
int ObLogPlan::candi_allocate_for_update_material()
{
int ret = OB_SUCCESS;
ObSEArray<CandidatePlan, 8> best_plans;
ObExchangeInfo exch_info;
if (OB_FAIL(get_minimal_cost_candidates(candidates_.candidate_plans_, best_plans))) {
LOG_WARN("failed to get minimal cost candidates", K(ret));
}
@ -13000,11 +13002,13 @@ int ObLogPlan::candi_allocate_material()
if (OB_ISNULL(best_plans.at(i).plan_tree_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null pointer", K(ret));
} else if (best_plans.at(i).plan_tree_->is_distributed() &&
OB_FAIL(allocate_exchange_as_top(best_plans.at(i).plan_tree_, exch_info))) {
LOG_WARN("failed to allocate exchange op", K(ret));
} else if (OB_FAIL(allocate_material_as_top(best_plans.at(i).plan_tree_))) {
LOG_WARN("fail to allocate material as top", K(ret));
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(prune_and_keep_best_plans(best_plans))) {
LOG_WARN("failed to prune and keep best plans", K(ret));

View File

@ -1295,7 +1295,7 @@ public:
CalcPartIdType calc_id_type,
ObRawExpr *&expr);
int candi_allocate_material();
int candi_allocate_for_update_material();
int allocate_material_for_recursive_cte_plan(ObIArray<ObLogicalOperator*> &child_ops);

View File

@ -4157,21 +4157,15 @@ int ObSelectLogPlan::allocate_plan_top()
}
}
//allocate temp-table transformation if needed.
if (OB_SUCC(ret) && !get_optimizer_context().get_temp_table_infos().empty() && is_final_root_plan()) {
if (OB_FAIL(candi_allocate_temp_table_transformation())) {
LOG_WARN("failed to allocate transformation operator", K(ret));
} else {
LOG_TRACE("succeed to allocate temp-table transformation",
K(candidates_.candidate_plans_.count()));
}
}
// allocate root exchange
if (OB_SUCC(ret) && is_final_root_plan()) {
// allocate material if there is for update.
if (optimizer_context_.has_for_update() && OB_FAIL(candi_allocate_material())) {
if (optimizer_context_.has_for_update() && OB_FAIL(candi_allocate_for_update_material())) {
LOG_WARN("failed to allocate material", K(ret));
//allocate temp-table transformation if needed.
} else if (!get_optimizer_context().get_temp_table_infos().empty() &&
OB_FAIL(candi_allocate_temp_table_transformation())) {
LOG_WARN("failed to allocate transformation operator", K(ret));
} else if (OB_FAIL(candi_allocate_root_exchange())) {
LOG_WARN("failed to allocate root exchange", K(ret));
} else {