[FEAT MERGE] performance optimzation for OLTP
Co-authored-by: dimstars <liangjinrongcm@gmail.com> Co-authored-by: pe-99y <315053752@qq.com>
This commit is contained in:
@ -277,6 +277,7 @@ int ObMPQuery::process()
|
||||
"trans_id", session.get_tx_id(), K(session));
|
||||
} else if (queries.count() > 1
|
||||
&& OB_FAIL(try_batched_multi_stmt_optimization(session,
|
||||
conn,
|
||||
queries,
|
||||
parse_stat,
|
||||
optimization_done,
|
||||
@ -325,6 +326,7 @@ int ObMPQuery::process()
|
||||
// 原来的值默认为true,会影响单条sql的二次路由,现在改为用 queries.count() 判断。
|
||||
bool is_part_of_multi = queries.count() > 1 ? true : false;
|
||||
ret = process_single_stmt(ObMultiStmtItem(is_part_of_multi, i, queries.at(i)),
|
||||
conn,
|
||||
session,
|
||||
has_more,
|
||||
force_sync_resp,
|
||||
@ -349,6 +351,7 @@ int ObMPQuery::process()
|
||||
EVENT_INC(SQL_SINGLE_QUERY_COUNT);
|
||||
// 处理普通的Single Statement
|
||||
ret = process_single_stmt(ObMultiStmtItem(false, 0, sql_),
|
||||
conn,
|
||||
session,
|
||||
has_more,
|
||||
force_sync_resp,
|
||||
@ -420,6 +423,7 @@ int ObMPQuery::process()
|
||||
* for details, please ref to
|
||||
*/
|
||||
int ObMPQuery::try_batched_multi_stmt_optimization(sql::ObSQLSessionInfo &session,
|
||||
ObSMConnection *conn,
|
||||
common::ObIArray<ObString> &queries,
|
||||
const ObMPParseStat &parse_stat,
|
||||
bool &optimization_done,
|
||||
@ -440,6 +444,7 @@ int ObMPQuery::try_batched_multi_stmt_optimization(sql::ObSQLSessionInfo &sessio
|
||||
} else if (!use_plan_cache) {
|
||||
// 不打开plan_cache开关,则优化不支持
|
||||
} else if (OB_FAIL(process_single_stmt(ObMultiStmtItem(false, 0, sql_, &queries, is_ins_multi_val_opt),
|
||||
conn,
|
||||
session,
|
||||
has_more,
|
||||
force_sync_resp,
|
||||
@ -463,6 +468,7 @@ int ObMPQuery::try_batched_multi_stmt_optimization(sql::ObSQLSessionInfo &sessio
|
||||
}
|
||||
|
||||
int ObMPQuery::process_single_stmt(const ObMultiStmtItem &multi_stmt_item,
|
||||
ObSMConnection *conn,
|
||||
ObSQLSessionInfo &session,
|
||||
bool has_more_result,
|
||||
bool force_sync_resp,
|
||||
@ -473,7 +479,6 @@ int ObMPQuery::process_single_stmt(const ObMultiStmtItem &multi_stmt_item,
|
||||
FLTSpanGuard(mpquery_single_stmt);
|
||||
ctx_.spm_ctx_.reset();
|
||||
bool need_response_error = true;
|
||||
const bool enable_trace_log = lib::is_trace_log_enabled();
|
||||
session.get_raw_audit_record().request_memory_used_ = 0;
|
||||
observer::ObProcessMallocCallback pmcb(0,
|
||||
session.get_raw_audit_record().request_memory_used_);
|
||||
@ -485,14 +490,12 @@ int ObMPQuery::process_single_stmt(const ObMultiStmtItem &multi_stmt_item,
|
||||
session.set_curr_trans_last_stmt_end_time(0);
|
||||
|
||||
//============================ 注意这些变量的生命周期 ================================
|
||||
ObSessionStatEstGuard stat_est_guard(get_conn()->tenant_->id(), session.get_sessid());
|
||||
ObSessionStatEstGuard stat_est_guard(conn->tenant_->id(), session.get_sessid());
|
||||
if (OB_FAIL(init_process_var(ctx_, multi_stmt_item, session))) {
|
||||
LOG_WARN("init process var failed.", K(ret), K(multi_stmt_item));
|
||||
} else {
|
||||
if (enable_trace_log) {
|
||||
//set session log_level.Must use ObThreadLogLevelUtils::clear() in pair
|
||||
ObThreadLogLevelUtils::init(session.get_log_id_level_map());
|
||||
}
|
||||
//set session log_level.Must use ObThreadLogLevelUtils::clear() in pair
|
||||
ObThreadLogLevelUtils::init(session.get_log_id_level_map());
|
||||
// obproxy may use 'SET @@last_schema_version = xxxx' to set newest schema,
|
||||
// observer will force refresh schema if local_schema_version < last_schema_version;
|
||||
if (OB_FAIL(check_and_refresh_schema(session.get_login_tenant_id(),
|
||||
|
||||
Reference in New Issue
Block a user