From e02b6604ef8048d62e4edde5c7d0fdafa76c35e5 Mon Sep 17 00:00:00 2001 From: AntiTopQuark Date: Fri, 6 Dec 2024 07:15:36 +0000 Subject: [PATCH] fix SQL__COUNT statistic item contain inner sql --- .../src/lib/statistic_event/ob_stat_event.h | 6 ++++++ src/objit/src/ob_llvm_di_helper.cpp | 6 +++--- src/sql/executor/ob_executor.cpp | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/deps/oblib/src/lib/statistic_event/ob_stat_event.h b/deps/oblib/src/lib/statistic_event/ob_stat_event.h index 8f3c3f204..77b3dde63 100644 --- a/deps/oblib/src/lib/statistic_event/ob_stat_event.h +++ b/deps/oblib/src/lib/statistic_event/ob_stat_event.h @@ -201,6 +201,12 @@ STAT_EVENT_ADD_DEF(SQL_LOCAL_TIME, "sql local execute time", ObStatClassIds::SQL STAT_EVENT_ADD_DEF(SQL_REMOTE_TIME, "sql remote execute time", ObStatClassIds::SQL, 40117, false, true, true) STAT_EVENT_ADD_DEF(SQL_DISTRIBUTED_TIME, "sql distributed execute time", ObStatClassIds::SQL, 40118, false, true, true) STAT_EVENT_ADD_DEF(SQL_FAIL_COUNT, "sql fail count", ObStatClassIds::SQL, 40119, false, true, true) +STAT_EVENT_ADD_DEF(SQL_INNER_LOCAL_COUNT, "inner sql local count", ObStatClassIds::SQL, 40120, false, true, true) +STAT_EVENT_ADD_DEF(SQL_INNER_REMOTE_COUNT, "inner sql remote count", ObStatClassIds::SQL, 40121, false, true, true) +STAT_EVENT_ADD_DEF(SQL_INNER_DISTRIBUTED_COUNT, "inner sql distributed count", ObStatClassIds::SQL, 40122, false, true, true) +STAT_EVENT_ADD_DEF(SQL_INNER_LOCAL_TIME, "inner sql local execute time", ObStatClassIds::SQL, 40123, false, true, false) +STAT_EVENT_ADD_DEF(SQL_INNER_REMOTE_TIME, "inner sql remote execute time", ObStatClassIds::SQL, 40124, false, true, false) +STAT_EVENT_ADD_DEF(SQL_INNER_DISTRIBUTED_TIME, "inner sql distributed execute time", ObStatClassIds::SQL, 40125, false, true, false) // CACHE STAT_EVENT_ADD_DEF(ROW_CACHE_HIT, "row cache hit", ObStatClassIds::CACHE, 50000, true, true, true) diff --git a/src/objit/src/ob_llvm_di_helper.cpp b/src/objit/src/ob_llvm_di_helper.cpp index 1dea7eade..2d3b9482f 100644 --- a/src/objit/src/ob_llvm_di_helper.cpp +++ b/src/objit/src/ob_llvm_di_helper.cpp @@ -308,9 +308,9 @@ int ObLLVMDIHelper::create_struct_type( int ret = OB_SUCCESS; ObDIFile *file = NULL; ObDIScope *scope = NULL; - unsigned flags = 0; - ObDIType *type_ptr = NULL; - if (name.empty() + unsigned flags = 0; + ObDIType *type_ptr = NULL; + if (name.empty() || OB_ISNULL(jc_) || OB_ISNULL(file = jc_->file_) || OB_ISNULL(scope = diff --git a/src/sql/executor/ob_executor.cpp b/src/sql/executor/ob_executor.cpp index fc1568721..e9e42a8ac 100644 --- a/src/sql/executor/ob_executor.cpp +++ b/src/sql/executor/ob_executor.cpp @@ -97,7 +97,11 @@ int ObExecutor::execute_plan(ObExecContext &ctx) switch (execute_type) { case OB_PHY_PLAN_LOCAL: { - EVENT_INC(SQL_LOCAL_COUNT); + if (session_info->is_inner()) { + EVENT_INC(SQL_INNER_LOCAL_COUNT); + } else { + EVENT_INC(SQL_LOCAL_COUNT); + } ObOperator *op = NULL; if (OB_FAIL(phy_plan_->get_root_op_spec()->create_operator(ctx, op))) { LOG_WARN("create operator from spec failed", K(ret)); @@ -110,11 +114,19 @@ int ObExecutor::execute_plan(ObExecContext &ctx) break; } case OB_PHY_PLAN_REMOTE: - EVENT_INC(SQL_REMOTE_COUNT); + if (session_info->is_inner()) { + EVENT_INC(SQL_INNER_REMOTE_COUNT); + } else { + EVENT_INC(SQL_REMOTE_COUNT); + } ret = execute_remote_single_partition_plan(ctx); break; case OB_PHY_PLAN_DISTRIBUTED: - EVENT_INC(SQL_DISTRIBUTED_COUNT); + if (session_info->is_inner()) { + EVENT_INC(SQL_INNER_DISTRIBUTED_COUNT); + } else { + EVENT_INC(SQL_DISTRIBUTED_COUNT); + } // PX 特殊路径 // PX 模式下,调度工作由 ObPxCoord 算子负责 ret = execute_static_cg_px_plan(ctx);