提交 b78e3041 编写于 作者: B bx0 提交者: wangzelin.wzl

OB query sql_id field in VIEW gv$sql_audit display error

上级 e1d32c1a
......@@ -3183,8 +3183,10 @@ int ObSql::handle_physical_plan(
} else if (context.multi_stmt_item_.is_batched_multi_stmt() && is_valid && session.use_static_typing_engine()) {
ret = STATIC_ENG_NOT_IMPLEMENT;
LOG_WARN("static engine not implement batched multi stmt, will retry", K(ret));
} else if (OB_FAIL(generate_sql_id(pc_ctx, add_plan_to_pc))) {
LOG_WARN("fail to generate sql id", K(ret));
}
generate_sql_id(pc_ctx, add_plan_to_pc, ret);
if (OB_FAIL(ret)) {
// do nothing
} else if (OB_FAIL(generate_physical_plan(parse_result, &pc_ctx, context, result))) {
if (OB_ERR_PROXY_REROUTE == ret) {
LOG_DEBUG("Failed to generate plan", K(ret));
......@@ -3412,16 +3414,14 @@ int ObSql::replace_const_expr(ObRawExpr* raw_expr, ParamStore& param_store)
return ret;
}
int ObSql::generate_sql_id(ObPlanCacheCtx& pc_ctx, bool add_plan_to_pc)
void ObSql::generate_sql_id(ObPlanCacheCtx &pc_ctx, bool add_plan_to_pc, int err_code)
{
int ret = OB_SUCCESS;
if (add_plan_to_pc == false || pc_ctx.is_ps_mode_) {
if (add_plan_to_pc == false || pc_ctx.is_ps_mode_ || OB_SUCCESS != err_code) {
(void)ObSQLUtils::md5(pc_ctx.raw_sql_, pc_ctx.sql_ctx_.sql_id_, (int32_t)sizeof(pc_ctx.sql_ctx_.sql_id_));
} else {
(void)ObSQLUtils::md5(
pc_ctx.bl_key_.constructed_sql_, pc_ctx.sql_ctx_.sql_id_, (int32_t)sizeof(pc_ctx.sql_ctx_.sql_id_));
}
return ret;
}
int ObSql::calc_pre_calculable_exprs(const ObDMLStmt& stmt, const ObIArray<ObHiddenColumnItem>& calculable_exprs,
......
......@@ -291,7 +291,7 @@ private:
int replace_const_expr(common::ObIArray<ObRawExpr*>& raw_exprs, ParamStore& param_store);
int replace_const_expr(ObRawExpr* raw_expr, ParamStore& param_store);
int generate_sql_id(ObPlanCacheCtx& pc_ctx, bool add_plan_to_pc);
void generate_sql_id(ObPlanCacheCtx& pc_ctx, bool add_plan_to_pc, int err_code);
int pc_add_plan(ObPlanCacheCtx& pc_ctx, ObResultSet& result, ObOutlineState& outline_state, ObPlanCache* plan_cache);
// Check whether the parameterized template SQL can be prepared
void check_template_sql_can_be_prepare(ObPlanCacheCtx& pc_ctx, ObPhysicalPlan& plan);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册