Fix performance reduction for 4.2

This commit is contained in:
obdev 2023-05-12 09:41:32 +00:00 committed by ob-robot
parent 2da06fac24
commit c2f84470a2
7 changed files with 319592 additions and 448370 deletions

File diff suppressed because it is too large Load Diff

761887
observer.prof

File diff suppressed because it is too large Load Diff

View File

@ -193,9 +193,6 @@ int ObSrvMySQLXlator::translate(rpc::ObRequest &req, ObReqProcessor *&processor)
if (ObRequest::OB_MYSQL != req.get_type()) {
LOG_ERROR("can't translate non-mysql request");
ret = OB_ERR_UNEXPECTED;
} else if (OB_ISNULL(SQL_REQ_OP.get_sql_session(&req))) {
LOG_ERROR("req member is null");
ret = OB_ERR_UNEXPECTED;
} else {
if (req.is_in_connected_phase()) {
ret = get_mp_connect_processor(processor);

View File

@ -73,6 +73,7 @@ ObBasicSessionInfo::ObBasicSessionInfo()
unused_read_snapshot_version_(),
xid_(),
associated_xa_(false),
cached_tenant_config_version_(0),
sess_bt_buff_pos_(0),
sess_ref_cnt_(0),
sess_ref_seq_(0),
@ -264,6 +265,7 @@ void ObBasicSessionInfo::destroy()
tx_result_.reset();
xid_.reset();
associated_xa_ = false;
cached_tenant_config_version_ = 0;
magic_num_ = 0x86427531;
if (thread_data_.cur_query_ != nullptr) {
ob_free(thread_data_.cur_query_);
@ -289,6 +291,7 @@ void ObBasicSessionInfo::clean_status()
}
xid_.reset();
associated_xa_ = false;
cached_tenant_config_version_ = 0;
set_valid(true);
thread_data_.cur_query_start_time_ = 0;
thread_data_.cur_query_len_ = 0;
@ -310,6 +313,7 @@ void ObBasicSessionInfo::reset(bool skip_sys_var)
}
xid_.reset();
associated_xa_ = false;
cached_tenant_config_version_ = 0;
is_deserialized_ = false;
CHAR_CARRAY_INIT(tenant_);
tenant_id_ = OB_INVALID_ID;
@ -1665,19 +1669,16 @@ int ObBasicSessionInfo::update_sys_variable(const ObSysVarClassType sys_var_id,
int ObBasicSessionInfo::gen_configs_in_pc_str()
{
int ret = OB_SUCCESS;
const int64_t MAX_CONFIG_STR_SIZE = 512;
char *buf = NULL;
int64_t pos = 0;
if (!GCONF.is_valid()) {
// do nothing
} else {
int64_t cluster_config_version = GCONF.get_current_version();
int64_t tenant_config_version = (::oceanbase::omt::ObTenantConfigMgr::get_instance()).get_tenant_config_version(tenant_id_);
if (GCONF.is_valid()) {
int64_t cluster_config_version = GCONF.get_current_version();
if (!config_in_pc_str_.empty() &&
!inf_pc_configs_.is_out_of_date(cluster_config_version, tenant_config_version)) {
!inf_pc_configs_.is_out_of_date(cluster_config_version, cached_tenant_config_version_)) {
// unupdated configs do nothing
} else {
const int64_t MAX_CONFIG_STR_SIZE = 512;
char *buf = NULL;
int64_t pos = 0;
// update out-dated cached configs
// first time to generate configuaration strings, init allocator
if (is_first_gen_config_) {
@ -1702,7 +1703,7 @@ int ObBasicSessionInfo::gen_configs_in_pc_str()
LOG_WARN("failed to serialize configs", K(ret));
} else {
(void)config_in_pc_str_.assign(buf, int32_t(pos));
inf_pc_configs_.update_version(cluster_config_version, tenant_config_version);
inf_pc_configs_.update_version(cluster_config_version, cached_tenant_config_version_);
}
}
}

View File

@ -1274,6 +1274,7 @@ public:
int get_session_temp_table_used(bool &is_used) const;
int get_enable_optimizer_null_aware_antijoin(bool &is_enabled) const;
common::ActiveSessionStat &get_ash_stat() { return ash_stat_; }
void update_tenant_config_version(int64_t v) { cached_tenant_config_version_ = v; };
protected:
int process_session_variable(share::ObSysVarClassType var, const common::ObObj &value,
const bool check_timezone_valid = true,
@ -1990,6 +1991,7 @@ protected:
share::SCN unused_read_snapshot_version_;//serialize compatibility preserved
transaction::ObXATransID xid_;
bool associated_xa_; // session joined distr-xa-trans by xa-start
int64_t cached_tenant_config_version_;
public:
const transaction::ObXATransID &get_xid() const { return xid_; }
transaction::ObTransID get_tx_id() const { return tx_desc_ != NULL ? tx_desc_->get_tx_id() : transaction::ObTransID(); }

View File

@ -2445,6 +2445,8 @@ void ObSQLSessionInfo::ObCachedTenantConfigInfo::refresh()
//timezone的更新频率非常低,放到后台驱动
(void)session_->update_timezone_info();
ATOMIC_STORE(&last_check_ec_ts_, cur_ts);
session_->update_tenant_config_version(
(::oceanbase::omt::ObTenantConfigMgr::get_instance()).get_tenant_config_version(effective_tenant_id));
}
UNUSED(tmp_ret);
}

View File

@ -274,7 +274,7 @@ void ObTxRetainCtxMgr::try_advance_retain_ctx_gc(share::ObLSID ls_id)
const int64_t CUR_LS_CNT = MTL(ObLSService *)->get_ls_map()->get_ls_count();
const int64_t IDLE_GC_INTERVAL = 30 * 60 * 1000 * 1000; // 30 min
const int64_t MIN_RETAIN_CTX_GC_THRESHOLD = 5000;
const int64_t MIN_RETAIN_CTX_GC_THRESHOLD = 1000;
ObTimeGuard tg(__func__, 1 * 1000 * 1000);
SpinRLockGuard guard(retain_ctx_lock_);