From 5b8a4b982a058074bee340df18e02fa8c3424fae Mon Sep 17 00:00:00 2001 From: a1iive Date: Wed, 12 Jul 2023 04:42:32 +0000 Subject: [PATCH] fix compaction progress timeguard & ignore ls_inner_tablet --- src/share/ob_occam_time_guard.h | 4 ++-- src/storage/compaction/ob_compaction_diagnose.cpp | 9 ++++++--- src/storage/compaction/ob_tablet_merge_ctx.cpp | 4 ++-- src/storage/compaction/ob_tablet_merge_ctx.h | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/share/ob_occam_time_guard.h b/src/share/ob_occam_time_guard.h index bda8f48bb..4f5ab7641 100644 --- a/src/share/ob_occam_time_guard.h +++ b/src/share/ob_occam_time_guard.h @@ -282,7 +282,7 @@ public: if (OB_LIKELY(idx_ < CAPACITY)) { int64_t now = common::ObTimeUtility::current_time(); line_array_[idx_] = static_cast(line); - click_poinsts_[idx_] = static_cast(now - last_click_ts_); + click_poinsts_[idx_] = now - last_click_ts_; last_click_ts_ = now; ++idx_; } @@ -354,7 +354,7 @@ protected: const char * const func_name_; const char * const log_mod_; uint16_t line_array_[CAPACITY]; - uint32_t click_poinsts_[CAPACITY]; + uint64_t click_poinsts_[CAPACITY]; }; class ObOccamFastTimeGuard// must used in same thread diff --git a/src/storage/compaction/ob_compaction_diagnose.cpp b/src/storage/compaction/ob_compaction_diagnose.cpp index 8250439a7..915ed1232 100755 --- a/src/storage/compaction/ob_compaction_diagnose.cpp +++ b/src/storage/compaction/ob_compaction_diagnose.cpp @@ -1158,8 +1158,9 @@ int ObCompactionDiagnoseMgr::diagnose_tablet_medium_merge( ObTabletMemberWrapper table_store_wrapper; ObArenaAllocator allocator; const compaction::ObMediumCompactionInfoList *medium_list = nullptr; - - if (OB_FAIL(tablet.fetch_table_store(table_store_wrapper))) { + if (tablet_id.is_ls_inner_tablet()) { + // do nothing + } else if (OB_FAIL(tablet.fetch_table_store(table_store_wrapper))) { LOG_WARN("fail to fetch table store", K(ret)); } else if (OB_ISNULL(last_major_sstable = table_store_wrapper.get_member()->get_major_sstables().get_boundary_table(true/*last*/))) { @@ -1212,7 +1213,9 @@ int ObCompactionDiagnoseMgr::diagnose_tablet_major_merge( const ObMergeType merge_type = MEDIUM_MERGE; int64_t max_sync_medium_scn = 0; ObTabletMemberWrapper table_store_wrapper; - if (OB_UNLIKELY(compaction_scn <= 0)) { + if (tablet_id.is_ls_inner_tablet()) { + // do nothing + } else if (OB_UNLIKELY(compaction_scn <= 0)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret), K(compaction_scn)); } else if (tablet.get_tablet_meta().has_transfer_table()) { diff --git a/src/storage/compaction/ob_tablet_merge_ctx.cpp b/src/storage/compaction/ob_tablet_merge_ctx.cpp index 3430af054..4c456a520 100755 --- a/src/storage/compaction/ob_tablet_merge_ctx.cpp +++ b/src/storage/compaction/ob_tablet_merge_ctx.cpp @@ -437,7 +437,7 @@ int64_t ObCompactionTimeGuard::to_string(char *buf, const int64_t buf_len) const if (total_cost > COMPACTION_SHOW_TIME_THRESHOLD) { float ratio = 0; for (int64_t idx = COMPACTION_POLICY; idx < idx_; ++idx) { - const uint32_t time_interval = click_poinsts_[idx]; + const uint64_t time_interval = click_poinsts_[idx]; ratio = (float)(time_interval)/ total_cost; if (ratio >= COMPACTION_SHOW_PERCENT_THRESHOLD || time_interval >= COMPACTION_SHOW_TIME_THRESHOLD) { fmt_ts_to_meaningful_str(buf, buf_len, pos, get_comp_event_str((ObTabletCompactionEvent)line_array_[idx]), click_poinsts_[idx]); @@ -1267,7 +1267,7 @@ void ObTabletMergeCtx::collect_running_info() const int64_t dag_key = merge_dag_->hash(); // calc flush macro speed - uint32_t exe_ts = time_guard_.get_specified_cost_time(ObCompactionTimeGuard::EXECUTE); + uint64_t exe_ts = time_guard_.get_specified_cost_time(ObCompactionTimeGuard::EXECUTE); if (exe_ts > 0 && sstable_merge_info.new_flush_occupy_size_ > 0) { sstable_merge_info.new_flush_data_rate_ = (int)(((float)sstable_merge_info.new_flush_occupy_size_/ 1024) / ((float)exe_ts / 1_s)); } diff --git a/src/storage/compaction/ob_tablet_merge_ctx.h b/src/storage/compaction/ob_tablet_merge_ctx.h index 76e05b4cb..2288aeb5b 100755 --- a/src/storage/compaction/ob_tablet_merge_ctx.h +++ b/src/storage/compaction/ob_tablet_merge_ctx.h @@ -130,8 +130,8 @@ public: void add_time_guard(const ObCompactionTimeGuard &other); ObCompactionTimeGuard & operator=(const ObCompactionTimeGuard &other); OB_INLINE bool is_empty() const { return 0 == idx_; } - OB_INLINE uint32_t get_specified_cost_time(const int64_t line) { - uint32_t ret_val = 0; + OB_INLINE uint64_t get_specified_cost_time(const int64_t line) { + uint64_t ret_val = 0; for (int64_t idx = 0; idx < idx_; ++idx) { if (line_array_[idx] == line) { ret_val = click_poinsts_[idx];