[to #56534142] test: error injection for pr-exec protocol

This commit is contained in:
haohao022
2024-06-17 13:17:53 +00:00
committed by ob-robot
parent 0052ee98b6
commit 317ca7bb41
3 changed files with 31 additions and 28 deletions

View File

@ -273,8 +273,14 @@ int ObSql::stmt_execute(const ObPsStmtId stmt_id,
LOG_WARN("failed to do sanity check", K(ret));
} else if (OB_FAIL(init_result_set(context, result))) {
LOG_WARN("failed to init result set", K(ret));
} else if (OB_FAIL(handle_ps_execute(stmt_id, stmt_type, params,
context, result, is_inner_sql))) {
} else if (
#ifdef ERRSIM
// inject error for pr-ex protocol only
// inject after `init_result_set` because retry test would check session ptr in the exec ctx,
// which is initialized by `init_result_set`.
OB_FAIL(EVENT_CALL(common::EventTable::COM_STMT_PREXECUTE_EXECUTE_ERROR, context.is_pre_execute_)) ||
#endif
OB_FAIL(handle_ps_execute(stmt_id, stmt_type, params, context, result, is_inner_sql))) {
if (OB_ERR_PROXY_REROUTE != ret) {
LOG_WARN("failed to handle ps execute", K(stmt_id), K(ret));
}
@ -1791,6 +1797,13 @@ int ObSql::handle_ps_prepare(const ObString &stmt,
LOG_WARN("failed to init result set", K(ret));
}
#ifdef ERRSIM
// inject error for pr-ex protocol only
if (OB_SUCC(ret)) {
ret = OB_E(common::EventTable::COM_STMT_PREXECUTE_PREPARE_ERROR, context.is_pre_execute_) OB_SUCCESS;
}
#endif
if (OB_SUCC(ret)) {
ObSQLSessionInfo &session = result.get_session();
ObPsCache *ps_cache = session.get_ps_cache();