[CP] [to #48934936] fix set_autocommit of session info
This commit is contained in:
@ -536,7 +536,7 @@ int ObPLContext::init(ObSQLSessionInfo &session_info,
|
|||||||
}
|
}
|
||||||
if (session_info.get_local_autocommit()) {
|
if (session_info.get_local_autocommit()) {
|
||||||
OX (reset_autocommit_ = true);
|
OX (reset_autocommit_ = true);
|
||||||
OX (session_info.set_autocommit(false));
|
OZ (session_info.set_autocommit(false));
|
||||||
}
|
}
|
||||||
} else { // MySQL Mode
|
} else { // MySQL Mode
|
||||||
// PL/SQL in MySQL mode may need to retry on LOCK_ON_CONFLICT error.
|
// PL/SQL in MySQL mode may need to retry on LOCK_ON_CONFLICT error.
|
||||||
@ -549,7 +549,7 @@ int ObPLContext::init(ObSQLSessionInfo &session_info,
|
|||||||
}
|
}
|
||||||
if (is_function_or_trigger && session_info.get_local_autocommit()) {
|
if (is_function_or_trigger && session_info.get_local_autocommit()) {
|
||||||
OX (reset_autocommit_ = true);
|
OX (reset_autocommit_ = true);
|
||||||
OX (session_info.set_autocommit(false));
|
OZ (session_info.set_autocommit(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ int ObPLContext::init(ObSQLSessionInfo &session_info,
|
|||||||
}
|
}
|
||||||
if (is_function_or_trigger && session_info.get_local_autocommit()) {
|
if (is_function_or_trigger && session_info.get_local_autocommit()) {
|
||||||
OX (reset_autocommit_ = true);
|
OX (reset_autocommit_ = true);
|
||||||
OX (session_info.set_autocommit(false));
|
OZ (session_info.set_autocommit(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,7 +756,6 @@ void ObPLContext::destory(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 清理serially package
|
// 清理serially package
|
||||||
int tmp_ret = OB_SUCCESS;
|
int tmp_ret = OB_SUCCESS;
|
||||||
if (OB_SUCCESS !=
|
if (OB_SUCCESS !=
|
||||||
@ -793,7 +792,12 @@ void ObPLContext::destory(
|
|||||||
}
|
}
|
||||||
// 无论如何都还原autocommit值
|
// 无论如何都还原autocommit值
|
||||||
if (reset_autocommit_) {
|
if (reset_autocommit_) {
|
||||||
session_info.set_autocommit(true);
|
int tmp_ret = OB_SUCCESS;
|
||||||
|
tmp_ret = session_info.set_autocommit(true);
|
||||||
|
if (tmp_ret != OB_SUCCESS) {
|
||||||
|
LOG_ERROR("restore autocommit value failed", K(tmp_ret), K(ret));
|
||||||
|
}
|
||||||
|
ret = OB_SUCCESS == ret ? tmp_ret : ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,7 +808,12 @@ void ObPLContext::destory(
|
|||||||
if (is_top_stack_) {
|
if (is_top_stack_) {
|
||||||
// 无论如何都还原autocommit值
|
// 无论如何都还原autocommit值
|
||||||
if (reset_autocommit_) {
|
if (reset_autocommit_) {
|
||||||
session_info.set_autocommit(true);
|
int tmp_ret = OB_SUCCESS;
|
||||||
|
tmp_ret = session_info.set_autocommit(true);
|
||||||
|
if (tmp_ret != OB_SUCCESS) {
|
||||||
|
LOG_ERROR("restore autocommit value failed", K(tmp_ret), K(ret));
|
||||||
|
}
|
||||||
|
ret = OB_SUCCESS == ret ? tmp_ret : ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3442,9 +3442,10 @@ int ObBasicSessionInfo::is_select_index_enabled(bool &select_index_enabled) cons
|
|||||||
return get_bool_sys_var(SYS_VAR_OB_ENABLE_INDEX_DIRECT_SELECT, select_index_enabled);
|
return get_bool_sys_var(SYS_VAR_OB_ENABLE_INDEX_DIRECT_SELECT, select_index_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObBasicSessionInfo::set_autocommit(bool autocommit)
|
int ObBasicSessionInfo::set_autocommit(bool autocommit)
|
||||||
{
|
{
|
||||||
sys_vars_cache_.set_autocommit(autocommit);
|
sys_vars_cache_.set_autocommit(autocommit);
|
||||||
|
return sys_var_inc_info_.add_sys_var_id(SYS_VAR_AUTOCOMMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObBasicSessionInfo::get_explicit_defaults_for_timestamp(
|
int ObBasicSessionInfo::get_explicit_defaults_for_timestamp(
|
||||||
|
|||||||
@ -480,7 +480,7 @@ public:
|
|||||||
uint64_t get_login_tenant_id() const { return tenant_id_; }
|
uint64_t get_login_tenant_id() const { return tenant_id_; }
|
||||||
void set_login_tenant_id(uint64_t tenant_id) { tenant_id_ = tenant_id; }
|
void set_login_tenant_id(uint64_t tenant_id) { tenant_id_ = tenant_id; }
|
||||||
bool is_tenant_changed() const { return tenant_id_ != effective_tenant_id_; }
|
bool is_tenant_changed() const { return tenant_id_ != effective_tenant_id_; }
|
||||||
void set_autocommit(bool autocommit);
|
int set_autocommit(bool autocommit);
|
||||||
int get_autocommit(bool &autocommit) const
|
int get_autocommit(bool &autocommit) const
|
||||||
{
|
{
|
||||||
autocommit = sys_vars_cache_.get_autocommit();
|
autocommit = sys_vars_cache_.get_autocommit();
|
||||||
|
|||||||
Reference in New Issue
Block a user