[to #56534142] test: error injection for pr-exec protocol
This commit is contained in:
@ -543,4 +543,11 @@ GLOBAL_ERRSIM_POINT_DEF(2304, EN_TRACEPOINT_TEST, "For testing new versions of t
|
|||||||
GLOBAL_ERRSIM_POINT_DEF(2400, EN_SQL_FORCE_DUMP, "For testing force dump once");
|
GLOBAL_ERRSIM_POINT_DEF(2400, EN_SQL_FORCE_DUMP, "For testing force dump once");
|
||||||
GLOBAL_ERRSIM_POINT_DEF(2401, EN_TEST_FOR_HASH_UNION, "Used to control whether to turn off the vectorization 2.0 hash set operator. It is turned on by default.");
|
GLOBAL_ERRSIM_POINT_DEF(2401, EN_TEST_FOR_HASH_UNION, "Used to control whether to turn off the vectorization 2.0 hash set operator. It is turned on by default.");
|
||||||
|
|
||||||
|
// Protocol begin 2450 - 2500
|
||||||
|
// pr-exec protocol
|
||||||
|
GLOBAL_ERRSIM_POINT_DEF(2450, COM_STMT_PREXECUTE_PREPARE_ERROR, "inject error at prepare stage for pr-exec protocol");
|
||||||
|
GLOBAL_ERRSIM_POINT_DEF(2451, COM_STMT_PREXECUTE_PS_CURSOR_OPEN_ERROR, "inject error at cursor open stage for pr-exec protocol");
|
||||||
|
GLOBAL_ERRSIM_POINT_DEF(2452, COM_STMT_PREXECUTE_EXECUTE_ERROR, "inject error at execute stage for pr-exec protocol");
|
||||||
|
// Protocol end
|
||||||
|
|
||||||
#endif /*GLOBAL_ERRSIM_POINT_DEF*/
|
#endif /*GLOBAL_ERRSIM_POINT_DEF*/
|
||||||
|
|||||||
@ -62,13 +62,6 @@ using namespace sql;
|
|||||||
using namespace pl;
|
using namespace pl;
|
||||||
namespace observer
|
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)
|
ObMPStmtPrexecute::ObMPStmtPrexecute(const ObGlobalContext &gctx)
|
||||||
: ObMPStmtExecute(gctx),
|
: ObMPStmtExecute(gctx),
|
||||||
sql_(),
|
sql_(),
|
||||||
@ -251,15 +244,10 @@ int ObMPStmtPrexecute::before_process()
|
|||||||
LOG_WARN("fail to set session active", K(ret));
|
LOG_WARN("fail to set session active", K(ret));
|
||||||
}
|
}
|
||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
if (
|
if (OB_FAIL(gctx_.sql_engine_->stmt_prepare(sql_,
|
||||||
#ifdef ERRSIM
|
|
||||||
OB_FAIL(COM_STMT_PREXECUTE_PREPARE_ERROR) ||
|
|
||||||
#endif
|
|
||||||
OB_FAIL(gctx_.sql_engine_->stmt_prepare(sql_,
|
|
||||||
get_ctx(),
|
get_ctx(),
|
||||||
result,
|
result,
|
||||||
false /*is_inner_sql*/))
|
false /*is_inner_sql*/))) {
|
||||||
) {
|
|
||||||
set_exec_start_timestamp(ObTimeUtility::current_time());
|
set_exec_start_timestamp(ObTimeUtility::current_time());
|
||||||
int cli_ret = OB_SUCCESS;
|
int cli_ret = OB_SUCCESS;
|
||||||
get_retry_ctrl().test_and_save_retry_state(gctx_,
|
get_retry_ctrl().test_and_save_retry_state(gctx_,
|
||||||
@ -487,7 +475,7 @@ int ObMPStmtPrexecute::execute_response(ObSQLSessionInfo &session,
|
|||||||
get_ctx().cur_sql_ = sql_;
|
get_ctx().cur_sql_ = sql_;
|
||||||
if (
|
if (
|
||||||
#ifdef ERRSIM
|
#ifdef ERRSIM
|
||||||
OB_FAIL(COM_STMT_PREXECUTE_PS_CURSOR_OPEN_ERROR) ||
|
OB_FAIL(common::EventTable::COM_STMT_PREXECUTE_PS_CURSOR_OPEN_ERROR) ||
|
||||||
#endif
|
#endif
|
||||||
OB_FAIL(ObSPIService::dbms_dynamic_open(&pl_ctx, *cursor))
|
OB_FAIL(ObSPIService::dbms_dynamic_open(&pl_ctx, *cursor))
|
||||||
) {
|
) {
|
||||||
@ -617,17 +605,12 @@ int ObMPStmtPrexecute::execute_response(ObSQLSessionInfo &session,
|
|||||||
ret = tmp_ret;
|
ret = tmp_ret;
|
||||||
LOG_WARN("execute server cursor failed.", K(ret));
|
LOG_WARN("execute server cursor failed.", K(ret));
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (OB_FAIL(gctx_.sql_engine_->stmt_execute(stmt_id_,
|
||||||
#ifdef ERRSIM
|
stmt_type_,
|
||||||
OB_FAIL(COM_STMT_PREXECUTE_EXECUTE_ERROR) ||
|
params,
|
||||||
#endif
|
ctx,
|
||||||
OB_FAIL(gctx_.sql_engine_->stmt_execute(stmt_id_,
|
result,
|
||||||
stmt_type_,
|
false /* is_inner_sql */))) {
|
||||||
params,
|
|
||||||
ctx,
|
|
||||||
result,
|
|
||||||
false /* is_inner_sql */))
|
|
||||||
) {
|
|
||||||
set_exec_start_timestamp(ObTimeUtility::current_time());
|
set_exec_start_timestamp(ObTimeUtility::current_time());
|
||||||
if (!THIS_WORKER.need_retry()) {
|
if (!THIS_WORKER.need_retry()) {
|
||||||
int cli_ret = OB_SUCCESS;
|
int cli_ret = OB_SUCCESS;
|
||||||
|
|||||||
@ -273,8 +273,14 @@ int ObSql::stmt_execute(const ObPsStmtId stmt_id,
|
|||||||
LOG_WARN("failed to do sanity check", K(ret));
|
LOG_WARN("failed to do sanity check", K(ret));
|
||||||
} else if (OB_FAIL(init_result_set(context, result))) {
|
} else if (OB_FAIL(init_result_set(context, result))) {
|
||||||
LOG_WARN("failed to init result set", K(ret));
|
LOG_WARN("failed to init result set", K(ret));
|
||||||
} else if (OB_FAIL(handle_ps_execute(stmt_id, stmt_type, params,
|
} else if (
|
||||||
context, result, is_inner_sql))) {
|
#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) {
|
if (OB_ERR_PROXY_REROUTE != ret) {
|
||||||
LOG_WARN("failed to handle ps execute", K(stmt_id), K(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));
|
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)) {
|
if (OB_SUCC(ret)) {
|
||||||
ObSQLSessionInfo &session = result.get_session();
|
ObSQLSessionInfo &session = result.get_session();
|
||||||
ObPsCache *ps_cache = session.get_ps_cache();
|
ObPsCache *ps_cache = session.get_ps_cache();
|
||||||
|
|||||||
Reference in New Issue
Block a user