OB query sql_id field in VIEW gv$sql_audit display error

This commit is contained in:
bx0
2021-09-26 21:06:59 +08:00
committed by wangzelin.wzl
parent e1d32c1abb
commit b78e3041b2
2 changed files with 7 additions and 7 deletions

View File

@ -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,