add param proxy_readonly_transaction_routing_policy
This commit is contained in:
@ -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",
|
DEF_BOOL(_auto_drop_tenant_if_restore_failed, OB_CLUSTER_PARAMETER, "True",
|
||||||
"auto drop restoring tenant if physical restore fails",
|
"auto drop restoring tenant if physical restore fails",
|
||||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
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 "sql/engine/ob_physical_plan.h"
|
||||||
#include "storage/transaction/ob_weak_read_util.h" //ObWeakReadUtil
|
#include "storage/transaction/ob_weak_read_util.h" //ObWeakReadUtil
|
||||||
#include "observer/omt/ob_tenant_timezone_mgr.h"
|
#include "observer/omt/ob_tenant_timezone_mgr.h"
|
||||||
|
#include "observer/omt/ob_tenant_config_mgr.h"
|
||||||
|
|
||||||
using namespace oceanbase::common;
|
using namespace oceanbase::common;
|
||||||
using namespace oceanbase::share;
|
using namespace oceanbase::share;
|
||||||
@ -129,8 +130,18 @@ ObBasicSessionInfo::~ObBasicSessionInfo()
|
|||||||
|
|
||||||
bool ObBasicSessionInfo::is_server_status_in_transaction() const
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user