Revert [CP] Fix: affected row sync

This commit is contained in:
yaojing624
2023-11-22 03:15:17 +00:00
committed by ob-robot
parent 4531a5b37d
commit 2a89240728
10 changed files with 12 additions and 165 deletions

View File

@ -604,7 +604,7 @@ OB_INLINE void ObResultSet::store_affected_rows(ObPhysicalPlanCtx &plan_ctx)
affected_row = get_affected_rows();
}
NG_TRACE_EXT(affected_rows, OB_ID(affected_rows), affected_row);
my_session_.update_sys_variable(SYS_VAR__AFFECTED_ROWS, affected_row);
my_session_.set_affected_rows(affected_row);
}
OB_INLINE void ObResultSet::store_found_rows(ObPhysicalPlanCtx &plan_ctx)
@ -620,7 +620,7 @@ OB_INLINE void ObResultSet::store_found_rows(ObPhysicalPlanCtx &plan_ctx)
int64_t found_rows = -1;
found_rows = plan_ctx.get_found_rows();
rows = found_rows == 0 ? return_rows_ : found_rows;
my_session_.update_sys_variable(SYS_VAR__FOUND_ROWS, rows);
my_session_.set_found_rows(rows);
NG_TRACE_EXT(store_found_rows,
OB_ID(found_rows), found_rows,
OB_ID(return_rows), return_rows_);

View File

@ -79,8 +79,6 @@ ObBasicSessionInfo::ObBasicSessionInfo(const uint64_t tenant_id)
sess_bt_buff_pos_(0),
sess_ref_cnt_(0),
sess_ref_seq_(0),
found_rows_(1),
affected_rows_(-1),
block_allocator_(SMALL_BLOCK_SIZE, common::OB_MALLOC_NORMAL_BLOCK_SIZE - 32,
//这里减32是为了适配ObMalloc对齐规则, 防止超8k的内存分配
ObMalloc(lib::ObMemAttr(orig_tenant_id_, ObModIds::OB_SQL_SESSION_SBLOCK))),
@ -438,8 +436,6 @@ void ObBasicSessionInfo::reset(bool skip_sys_var)
last_update_tz_time_ = 0;
is_client_sessid_support_ = false;
sess_bt_buff_pos_ = 0;
found_rows_ = 1;
affected_rows_ = -1;
ATOMIC_SET(&sess_ref_cnt_ , 0);
// 最后再重置所有allocator
// 否则thread_data_.user_name_之类的属性会有野指针,在session_mgr的foreach接口遍历时可能core掉。
@ -2673,18 +2669,6 @@ OB_INLINE int ObBasicSessionInfo::process_session_variable(ObSysVarClassType var
OX (sys_vars_cache_.set_default_lob_inrow_threshold(int_val));
break;
}
case SYS_VAR__AFFECTED_ROWS: {
int64_t affect_rows = 0;
OZ (val.get_int(affect_rows), val);
set_affected_rows(affect_rows);
break;
}
case SYS_VAR__FOUND_ROWS: {
int64_t found_rows = 0;
OZ (val.get_int(found_rows), val);
set_found_rows(found_rows);
break;
}
default: {
//do nothing
}
@ -4412,9 +4396,7 @@ OB_DEF_SERIALIZE(ObBasicSessionInfo)
flt_vars_.row_traceformat_,
flt_vars_.last_flt_span_id_,
exec_min_cluster_version_,
is_client_sessid_support_,
found_rows_,
affected_rows_);
is_client_sessid_support_);
}();
return ret;
}
@ -4616,9 +4598,7 @@ OB_DEF_DESERIALIZE(ObBasicSessionInfo)
}
if (OB_SUCC(ret) && pos < data_len) {
LST_DO_CODE(OB_UNIS_DECODE,
is_client_sessid_support_,
found_rows_,
affected_rows_);
is_client_sessid_support_);
}
// deep copy string.
if (OB_SUCC(ret)) {
@ -4933,9 +4913,7 @@ OB_DEF_SERIALIZE_SIZE(ObBasicSessionInfo)
flt_vars_.row_traceformat_,
flt_vars_.last_flt_span_id_,
exec_min_cluster_version_,
is_client_sessid_support_,
found_rows_,
affected_rows_);
is_client_sessid_support_);
return len;
}

View File

@ -586,13 +586,6 @@ public:
sql_select_limit = sys_vars_cache_.get_sql_select_limit();
return common::OB_SUCCESS;
}
void set_found_rows(const int64_t count) { found_rows_ = count; }
int64_t get_found_rows() const { return found_rows_; }
void set_affected_rows(const int64_t count)
{
affected_rows_ = count;
}
int64_t get_affected_rows() const { return affected_rows_; }
// session保留compatible mode,主要用于传递mode,方便后续进行guard切换,如inner sql connection等
// 其他需要用mode地方请尽量使用线程上的is_oracle|mysql_mode
// 同时可以使用check_compatibility_mode来检查线程与session上的mode是否一致
@ -2078,8 +2071,6 @@ private:
int sess_bt_buff_pos_;
int32_t sess_ref_cnt_;
int32_t sess_ref_seq_;
int64_t found_rows_;
int64_t affected_rows_;
protected:
// alloc at most SMALL_BLOCK_SIZE bytes for each alloc() call.

View File

@ -846,6 +846,10 @@ public:
transaction::ObTxClass get_trans_type() const { return trans_type_; }
void get_session_priv_info(share::schema::ObSessionPrivInfo &session_priv) const;
void set_found_rows(const int64_t count) { found_rows_ = count; }
int64_t get_found_rows() const { return found_rows_; }
void set_affected_rows(const int64_t count) { affected_rows_ = count; }
int64_t get_affected_rows() const { return affected_rows_; }
bool has_user_super_privilege() const;
bool has_user_process_privilege() const;
int check_read_only_privilege(const bool read_only,