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

This commit is contained in:
haohao022 2024-05-21 10:16:52 +00:00 committed by ob-robot
parent e9c359425c
commit 9476c37f88

View File

@ -62,6 +62,13 @@ using namespace sql;
using namespace pl;
namespace observer
{
#ifdef ERRSIM
ERRSIM_POINT_DEF(COM_STMT_PREXECUTE_PREPARE_ERROR);
ERRSIM_POINT_DEF(COM_STMT_PREXECUTE_PS_CURSOR_OPEN_ERROR);
ERRSIM_POINT_DEF(COM_STMT_PREXECUTE_EXECUTE_ERROR);
#endif
ObMPStmtPrexecute::ObMPStmtPrexecute(const ObGlobalContext &gctx)
: ObMPStmtExecute(gctx),
sql_(),
@ -244,10 +251,15 @@ int ObMPStmtPrexecute::before_process()
LOG_WARN("fail to set session active", K(ret));
}
if (OB_SUCC(ret)) {
if (OB_FAIL(gctx_.sql_engine_->stmt_prepare(sql_,
if (
#ifdef ERRSIM
OB_FAIL(COM_STMT_PREXECUTE_PREPARE_ERROR) ||
#endif
OB_FAIL(gctx_.sql_engine_->stmt_prepare(sql_,
get_ctx(),
result,
false/*is_inner_sql*/))) {
false /*is_inner_sql*/))
) {
set_exec_start_timestamp(ObTimeUtility::current_time());
int cli_ret = OB_SUCCESS;
get_retry_ctrl().test_and_save_retry_state(gctx_,
@ -473,7 +485,12 @@ int ObMPStmtPrexecute::execute_response(ObSQLSessionInfo &session,
ObPLExecCtx pl_ctx(cursor->get_allocator(), &result.get_exec_context(), NULL/*params*/,
NULL/*result*/, &ret, NULL/*func*/, true);
get_ctx().cur_sql_ = sql_;
if (OB_FAIL(ObSPIService::dbms_dynamic_open(&pl_ctx, *cursor))) {
if (
#ifdef ERRSIM
OB_FAIL(COM_STMT_PREXECUTE_PS_CURSOR_OPEN_ERROR) ||
#endif
OB_FAIL(ObSPIService::dbms_dynamic_open(&pl_ctx, *cursor))
) {
LOG_WARN("cursor open faild.", K(cursor->get_id()));
// select do not support arraybinding
if (!THIS_WORKER.need_retry()) {
@ -597,12 +614,17 @@ int ObMPStmtPrexecute::execute_response(ObSQLSessionInfo &session,
ret = tmp_ret;
LOG_WARN("execute server cursor failed.", K(ret));
}
} else if (OB_FAIL(gctx_.sql_engine_->stmt_execute(stmt_id_,
stmt_type_,
params,
ctx,
result,
false /* is_inner_sql */))) {
} else if (
#ifdef ERRSIM
OB_FAIL(COM_STMT_PREXECUTE_EXECUTE_ERROR) ||
#endif
OB_FAIL(gctx_.sql_engine_->stmt_execute(stmt_id_,
stmt_type_,
params,
ctx,
result,
false /* is_inner_sql */))
) {
set_exec_start_timestamp(ObTimeUtility::current_time());
if (!THIS_WORKER.need_retry()) {
int cli_ret = OB_SUCCESS;