[master] add session id into autocommit log

This commit is contained in:
chinaxing
2023-02-16 13:12:15 +00:00
committed by ob-robot
parent e27bec92d2
commit 88ee461fbe
4 changed files with 8 additions and 3 deletions

View File

@ -209,6 +209,7 @@ int ObMPConnect::process()
ObSMConnection *conn = NULL;
uint64_t tenant_id = OB_INVALID_ID;
ObSQLSessionInfo *session = NULL;
bool autocommit = false;
MAKE_TENANT_SWITCH_SCOPE_GUARD(guard);
THIS_WORKER.set_timeout_ts(INT64_MAX); // avoid see a former timeout value
if (THE_TRACE != nullptr) {
@ -275,6 +276,7 @@ int ObMPConnect::process()
"group_id", conn->group_id_,
"sql_req_level", conn->sql_req_level_);
conn->set_auth_phase();
session->get_autocommit(autocommit);
}
int proc_ret = ret;
@ -364,7 +366,7 @@ int ObMPConnect::process()
K(from_java_client), K(from_oci_client), K(from_jdbc_client),
K(capability), K(proxy_capability), K(use_ssl),
"c/s protocol", get_cs_protocol_type_name(protoType),
K(proc_ret), K(ret));
K(autocommit), K(proc_ret), K(ret));
}
return ret;
}

View File

@ -935,8 +935,8 @@ int ObVariableSetExecutor::process_session_autocommit_hook(ObExecContext &exec_c
// 其它只影响AC标志位,但无需做commit操作
}
}
LOG_INFO("set var: autocommit", K(ret), K(orig_ac), "to", autocommit, K(my_session->get_sessid()));
}
LOG_INFO("set var: autocommit", K(ret), K(orig_ac), "to", autocommit);
return ret;
}

View File

@ -3534,6 +3534,8 @@ int ObBasicSessionInfo::replace_new_session_label(uint64_t policy_id, const ObLa
int64_t ObBasicSessionInfo::to_string(char *buf, const int64_t buf_len) const
{
int64_t pos = 0;
bool ac = false;
get_autocommit(ac),
J_OBJ_START();
J_KV(KP(this), "id", sessid_,
N_TENANT, get_tenant_name(), "tenant_id", tenant_id_,
@ -3542,6 +3544,7 @@ int64_t ObBasicSessionInfo::to_string(char *buf, const int64_t buf_len) const
N_USER, (lib::is_oracle_mode() ? get_user_name() : get_user_at_host()),
"consistency_level", consistency_level_,
"session_state", thread_data_.state_,
"autocommit", ac,
"tx", OB_P(tx_desc_));
J_OBJ_END();
return pos;

View File

@ -346,11 +346,11 @@ void ObSQLSessionInfo::reset(bool skip_sys_var)
optimizer_tracer_.reset();
sql_plan_manager_ = NULL;
destroy_session_plan_mgr();
txn_free_route_ctx_.reset();
expect_group_id_ = OB_INVALID_ID;
group_id_not_expected_ = false;
//call at last time
ObBasicSessionInfo::reset(skip_sys_var);
txn_free_route_ctx_.reset();
}
}