From 2b8af01498964d169d6f95030cb5265569865e42 Mon Sep 17 00:00:00 2001 From: chinaxing Date: Mon, 19 Feb 2024 07:46:24 +0000 Subject: [PATCH] [txn-route] in-txn reroute should be disabled if txn route was disabled --- src/sql/ob_sql.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/sql/ob_sql.cpp b/src/sql/ob_sql.cpp index 8cb85297ae..1c7aaaa886 100644 --- a/src/sql/ob_sql.cpp +++ b/src/sql/ob_sql.cpp @@ -5502,15 +5502,27 @@ int ObSql::check_need_reroute(ObPlanCacheCtx &pc_ctx, ObSQLSessionInfo &session, || plan->is_contain_oracle_trx_level_temporary_table()) { // access temp table } else { - fixed_route = false; + // check passed: special query which can not be reroute + // + // check txn free route is disabled, if so, when on txn start + // node, can not reroute + if (OB_FAIL(session.calc_txn_free_route())) { + LOG_WARN("cal txn free route failed", K(ret), K(session)); + } else if (session.can_txn_free_route()) { + fixed_route = false; + } else if (session.is_txn_free_route_temp()) { + fixed_route = false; + } else { + // fixed route if txn started on this node + } } if (fixed_route) { - // multi-stmt or stmt disallow on other node, can not be rerouted should_reroute = false; } } - if (OB_ISNULL(pc_ctx.sql_ctx_.schema_guard_)) { + if (OB_FAIL(ret)) { + } else if (OB_ISNULL(pc_ctx.sql_ctx_.schema_guard_)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid null schema guard", K(ret)); } else if (should_reroute) {