[CP] Fix: affected row sync

This commit is contained in:
obdev
2024-02-06 17:43:38 +00:00
committed by ob-robot
parent c492fbfe51
commit 33e94551f4
4 changed files with 21 additions and 6 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_.set_affected_rows(affected_row);
my_session_.update_sys_variable(SYS_VAR__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_.set_found_rows(rows);
my_session_.update_sys_variable(SYS_VAR__FOUND_ROWS, rows);
NG_TRACE_EXT(store_found_rows,
OB_ID(found_rows), found_rows,
OB_ID(return_rows), return_rows_);

View File

@ -2673,6 +2673,18 @@ 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
}

View File

@ -586,6 +586,13 @@ 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是否一致

View File

@ -846,10 +846,6 @@ 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,