提交 996bc85d 编写于 作者: O obdev 提交者: wangzelin.wzl

add param proxy_readonly_transaction_routing_policy

上级 d922e21a
......@@ -1434,3 +1434,7 @@ DEF_TIME(ilog_index_expire_time, OB_CLUSTER_PARAMETER, "7d", "[0s, 60d]",
DEF_BOOL(_auto_drop_tenant_if_restore_failed, OB_CLUSTER_PARAMETER, "True",
"auto drop restoring tenant if physical restore fails",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_BOOL(ob_proxy_readonly_transaction_routing_policy, OB_TENANT_PARAMETER, "true",
"Proxy route policy for readonly sql",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
......@@ -29,6 +29,7 @@
#include "sql/engine/ob_physical_plan.h"
#include "storage/transaction/ob_weak_read_util.h" //ObWeakReadUtil
#include "observer/omt/ob_tenant_timezone_mgr.h"
#include "observer/omt/ob_tenant_config_mgr.h"
using namespace oceanbase::common;
using namespace oceanbase::share;
......@@ -129,8 +130,18 @@ ObBasicSessionInfo::~ObBasicSessionInfo()
bool ObBasicSessionInfo::is_server_status_in_transaction() const
{
bool result = get_in_transaction() ||
(!get_local_autocommit() && trans_desc_.get_standalone_stmt_desc().is_snapshot_version_valid());
/*!
* readonly sql not in transaction, for compatible, we also need send in trans flag to proxy.
* for now,
* we use ob_proxy_readonly_transaction_routing_policy parameter decide to send in trans or not.
*/
bool result = get_in_transaction();
if (!result
&& !get_local_autocommit()
&& trans_desc_.get_standalone_stmt_desc().is_snapshot_version_valid()) {
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(get_effective_tenant_id()));
result = is_isolation_serializable() || tenant_config->ob_proxy_readonly_transaction_routing_policy;
}
return result;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册