to issue<49916547>:fix sql in pl remote execute report 4007

This commit is contained in:
hanr881
2023-05-25 23:41:35 +00:00
committed by ob-robot
parent ceccbab67c
commit 0743b644cf
3 changed files with 9 additions and 1 deletions

View File

@ -56,7 +56,8 @@ struct ObRemoteSqlInfo
is_original_ps_mode_(false),
ps_param_cnt_(0),
remote_sql_(),
ps_params_(nullptr)
ps_params_(nullptr),
sql_from_pl_(false)
{
}
@ -68,6 +69,7 @@ struct ObRemoteSqlInfo
int32_t ps_param_cnt_;
common::ObString remote_sql_;
ParamStore *ps_params_;
bool sql_from_pl_;
};
class ObPhysicalPlanCtx

View File

@ -332,6 +332,7 @@ OB_DEF_SERIALIZE(ObRemoteTask)
OB_UNIS_ENCODE(ps_params->at(i).get_param_flag());
}
OB_UNIS_ENCODE(remote_sql_info_->is_original_ps_mode_);
OB_UNIS_ENCODE(remote_sql_info_->sql_from_pl_);
return ret;
}
@ -369,6 +370,7 @@ OB_DEF_SERIALIZE_SIZE(ObRemoteTask)
OB_UNIS_ADD_LEN(ps_params->at(i).get_param_flag());
}
OB_UNIS_ADD_LEN(remote_sql_info_->is_original_ps_mode_);
OB_UNIS_ADD_LEN(remote_sql_info_->sql_from_pl_);
}
return len;
}
@ -432,6 +434,7 @@ OB_DEF_DESERIALIZE(ObRemoteTask)
}
}
OB_UNIS_DECODE(remote_sql_info_->is_original_ps_mode_);
OB_UNIS_DECODE(remote_sql_info_->sql_from_pl_);
}
return ret;
}

View File

@ -2156,6 +2156,7 @@ int ObSql::handle_remote_query(const ObRemoteSqlInfo &remote_sql_info,
bool use_plan_cache = session->get_local_ob_enable_plan_cache();
context.self_add_plan_ = false;
PlanCacheMode mode = remote_sql_info.use_ps_ ? PC_PS_MODE : PC_TEXT_MODE;
mode = remote_sql_info.sql_from_pl_ ? PC_PL_MODE : mode;
context.cur_sql_ = trimed_stmt;
pc_ctx = new (pc_ctx) ObPlanCacheCtx(trimed_stmt,
mode,
@ -2237,6 +2238,7 @@ int ObSql::handle_remote_query(const ObRemoteSqlInfo &remote_sql_info,
remote_sql_info.ps_params_->pop_back();
}
PlanCacheMode mode = remote_sql_info.use_ps_ ? PC_PS_MODE : PC_TEXT_MODE;
mode = remote_sql_info.sql_from_pl_ ? PC_PL_MODE : mode;
if (OB_FAIL(handle_physical_plan(trimed_stmt, context, tmp_result, *pc_ctx, get_plan_err))) {
if (OB_ERR_PROXY_REROUTE == ret) {
LOG_DEBUG("fail to handle physical plan", K(ret));
@ -4317,6 +4319,7 @@ int ObSql::after_get_plan(ObPlanCacheCtx &pc_ctx,
if (OB_SUCC(ret) && phy_plan->is_remote_plan()
&& !phy_plan->contains_temp_table()
&& !enable_send_plan) {
pctx->get_remote_sql_info().sql_from_pl_ = PC_PL_MODE == pc_ctx.mode_;
//处理远程plan转发SQL的情况
ParamStore &param_store = pctx->get_param_store_for_update();
if (OB_NOT_NULL(ps_params)) {