From e354f149d28475386f478da2d1d579e8ae5d03a5 Mon Sep 17 00:00:00 2001 From: LiuYoung00 Date: Tue, 11 Jul 2023 18:42:14 +0000 Subject: [PATCH] [CP] [to #50495693]prepare in prexecute reset session state --- src/observer/mysql/obmp_stmt_prexecute.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/observer/mysql/obmp_stmt_prexecute.cpp b/src/observer/mysql/obmp_stmt_prexecute.cpp index 39236c8e34..e4a3343427 100644 --- a/src/observer/mysql/obmp_stmt_prexecute.cpp +++ b/src/observer/mysql/obmp_stmt_prexecute.cpp @@ -77,6 +77,7 @@ ObMPStmtPrexecute::ObMPStmtPrexecute(const ObGlobalContext &gctx) int ObMPStmtPrexecute::before_process() { int ret = OB_SUCCESS; + ObSQLSessionInfo *session = NULL; if (OB_FAIL(ObMPBase::before_process())) { LOG_WARN("fail to call before process", K(ret)); @@ -357,9 +358,14 @@ int ObMPStmtPrexecute::before_process() } } session->set_last_trace_id(ObCurTraceId::get_trace_id()); - } - if (session != NULL) { - revert_session(session); + //对于tracelog的处理,不影响正常逻辑,错误码无须赋值给ret + if (session != NULL && OB_FAIL(ret)) { + int tmp_ret = OB_SUCCESS; + //清空WARNING BUFFER + ObSqlCtx sql_ctx; // sql_ctx do nothing in do_after_process + tmp_ret = do_after_process(*session, sql_ctx, false/*no asyn response*/); + UNUSED(tmp_ret); + } } } @@ -372,6 +378,10 @@ int ObMPStmtPrexecute::before_process() OZ (flush_buffer(true)); } + if (session != NULL) { + revert_session(session); + } + return ret; }