From b990a438da6e2f6c9c4f72628a569fdab5d35b55 Mon Sep 17 00:00:00 2001 From: TyphoonTai <531778559@qq.com> Date: Fri, 30 Jun 2023 16:09:19 +0800 Subject: [PATCH] modified: src/obproxy/proxy/mysql/ob_mysql_transact.cpp --- src/obproxy/proxy/mysql/ob_mysql_transact.cpp | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/obproxy/proxy/mysql/ob_mysql_transact.cpp b/src/obproxy/proxy/mysql/ob_mysql_transact.cpp index ef73e30..69665f3 100644 --- a/src/obproxy/proxy/mysql/ob_mysql_transact.cpp +++ b/src/obproxy/proxy/mysql/ob_mysql_transact.cpp @@ -6154,7 +6154,7 @@ int ObMysqlTransact::ObTransState::get_config_item(const ObString& cluster_name, } } } - bool is_request_follower = false; + bool is_request_follower = true; if (is_weak_read_user){ is_request_follower = (RequestFollower == 1); } else{ @@ -6166,20 +6166,22 @@ int ObMysqlTransact::ObTransState::get_config_item(const ObString& cluster_name, is_request_follower = (RequestFollower == int_item.get_value()); } } - bool is_sys_var_update = (session_info.is_request_follower_user() != is_request_follower); - session_info.set_is_request_follower_user(is_request_follower); - if (is_sys_var_update) { - ObString ob_read_consistency("ob_read_consistency"); - ObString weak; - if (session_info.is_request_follower_user()) { - weak = "2"; - } else { - weak = "3"; - } - if (OB_FAIL(session_info.update_sys_variable(ob_read_consistency, weak))) { - LOG_WARN("replace user variables failed", K(weak), K(ret)); - } else { - session_info.set_read_consistency_set_flag(true); + if (OB_SUCC(ret)) { + bool is_sys_var_update = (session_info.is_request_follower_user() != is_request_follower); + session_info.set_is_request_follower_user(is_request_follower); + if (is_sys_var_update) { + ObString ob_read_consistency("ob_read_consistency"); + ObString weak; + if (session_info.is_request_follower_user()) { + weak = "2"; + } else { + weak = "3"; + } + if (OB_FAIL(session_info.update_sys_variable(ob_read_consistency, weak))) { + LOG_WARN("replace user variables failed", K(weak), K(ret)); + } else { + session_info.set_read_consistency_set_flag(true); + } } } } -- GitLab