fix bug: plan stat incorrect when some error happened during query processing

This commit is contained in:
GongYusen
2024-01-11 03:48:27 +00:00
committed by ob-robot
parent ccd9f8e66a
commit 5db554a63f
3 changed files with 4 additions and 5 deletions

View File

@ -950,8 +950,7 @@ OB_INLINE int ObMPQuery::do_process(ObSQLSessionInfo &session,
} }
} }
//update v$sql statistics //update v$sql statistics
if ((OB_SUCC(ret) || audit_record.is_timeout()) if (session.get_local_ob_enable_plan_cache()
&& session.get_local_ob_enable_plan_cache()
&& !retry_ctrl_.need_retry()) { && !retry_ctrl_.need_retry()) {
ObIArray<ObTableRowCount> *table_row_count_list = NULL; ObIArray<ObTableRowCount> *table_row_count_list = NULL;
ObPhysicalPlanCtx *plan_ctx = result.get_exec_context().get_physical_plan_ctx(); ObPhysicalPlanCtx *plan_ctx = result.get_exec_context().get_physical_plan_ctx();

View File

@ -1366,8 +1366,7 @@ int ObMPStmtExecute::do_process(ObSQLSessionInfo &session,
} }
//update v$sql statistics //update v$sql statistics
if ((OB_SUCC(ret) || audit_record.is_timeout()) if (session.get_local_ob_enable_plan_cache()
&& session.get_local_ob_enable_plan_cache()
&& !retry_ctrl_.need_retry() && !retry_ctrl_.need_retry()
&& !is_ps_cursor()) { && !is_ps_cursor()) {
// ps cursor do this in inner open // ps cursor do this in inner open

View File

@ -478,7 +478,8 @@ void ObPhysicalPlan::update_plan_stat(const ObAuditRecordData &record,
if (record.is_timeout()) { if (record.is_timeout()) {
ATOMIC_INC(&(stat_.timeout_count_)); ATOMIC_INC(&(stat_.timeout_count_));
ATOMIC_AAF(&(stat_.total_process_time_), record.get_process_time()); ATOMIC_AAF(&(stat_.total_process_time_), record.get_process_time());
} else if (!GCONF.enable_perf_event) { // short route }
if (!GCONF.enable_perf_event) { // short route
ATOMIC_AAF(&(stat_.elapsed_time_), record.get_elapsed_time()); ATOMIC_AAF(&(stat_.elapsed_time_), record.get_elapsed_time());
ATOMIC_AAF(&(stat_.cpu_time_), record.get_elapsed_time() - record.exec_record_.wait_time_end_ ATOMIC_AAF(&(stat_.cpu_time_), record.get_elapsed_time() - record.exec_record_.wait_time_end_
- (record.exec_timestamp_.run_ts_ - record.exec_timestamp_.receive_ts_)); - (record.exec_timestamp_.run_ts_ - record.exec_timestamp_.receive_ts_));