[CP] Fix: When removing the thread lock to acquire the session

This commit is contained in:
obdev
2024-02-08 04:45:10 +00:00
committed by ob-robot
parent 949705a060
commit 7da77afa77

View File

@ -6500,16 +6500,17 @@ int ObExecEnv::store(ObBasicSessionInfo &session)
void ObBasicSessionInfo::on_get_session() void ObBasicSessionInfo::on_get_session()
{ {
LockGuard lock_guard(thread_data_mutex_);
const char *str = lbt(); const char *str = lbt();
int len = STRLEN(str); int len = STRLEN(str);
if (sess_bt_buff_pos_ + len + 2 < MAX_SESS_BT_BUFF_SIZE) { int pos = sess_bt_buff_pos_;
MEMCPY(sess_bt_buff_ + sess_bt_buff_pos_, str, len); if (pos + len + 2 < MAX_SESS_BT_BUFF_SIZE) {
sess_bt_buff_pos_ += len; MEMCPY(sess_bt_buff_ + pos, str, len);
sess_bt_buff_[sess_bt_buff_pos_] = ';'; pos += len;
sess_bt_buff_pos_ += 1; sess_bt_buff_[pos] = ';';
sess_bt_buff_[sess_bt_buff_pos_] = '\0'; pos += 1;
sess_bt_buff_[pos] = '\0';
} }
sess_bt_buff_pos_ = pos;
(void)ATOMIC_AAF(&sess_ref_cnt_, 1); (void)ATOMIC_AAF(&sess_ref_cnt_, 1);
(void)ATOMIC_AAF(&sess_ref_seq_, 1); (void)ATOMIC_AAF(&sess_ref_seq_, 1);
LOG_INFO("on get session", KP(this), K(sess_ref_cnt_), K(sess_ref_seq_), LOG_INFO("on get session", KP(this), K(sess_ref_cnt_), K(sess_ref_seq_),
@ -6518,7 +6519,6 @@ void ObBasicSessionInfo::on_get_session()
void ObBasicSessionInfo::on_revert_session() void ObBasicSessionInfo::on_revert_session()
{ {
LockGuard lock_guard(thread_data_mutex_);
int32_t v = ATOMIC_AAF(&sess_ref_cnt_, -1); int32_t v = ATOMIC_AAF(&sess_ref_cnt_, -1);
if (v <= 0) { if (v <= 0) {
sess_bt_buff_pos_ = 0; sess_bt_buff_pos_ = 0;