From 40f46b3fc8e880173797b3514942cf1fc5992676 Mon Sep 17 00:00:00 2001 From: a1iive Date: Tue, 28 Nov 2023 11:42:03 +0000 Subject: [PATCH] fix some bugs --- .../ob_all_virtual_server_compaction_progress.cpp | 3 ++- .../freeze/ob_major_merge_progress_checker.cpp | 4 +++- src/storage/compaction/ob_compaction_suggestion.cpp | 11 ++++++++++- src/storage/compaction/ob_compaction_suggestion.h | 2 +- src/storage/compaction/ob_medium_compaction_func.cpp | 2 +- .../compaction/ob_tenant_compaction_progress.cpp | 3 +++ .../compaction/ob_tenant_compaction_progress.h | 4 +++- 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/observer/virtual_table/ob_all_virtual_server_compaction_progress.cpp b/src/observer/virtual_table/ob_all_virtual_server_compaction_progress.cpp index a8edaefbf9..e63054730c 100644 --- a/src/observer/virtual_table/ob_all_virtual_server_compaction_progress.cpp +++ b/src/observer/virtual_table/ob_all_virtual_server_compaction_progress.cpp @@ -169,7 +169,8 @@ int ObAllVirtualServerCompactionProgress::fill_cells() } { int64_t pos = strlen(event_buf_); - databuff_printf(event_buf_, sizeof(event_buf_), pos, "is_inited:%d", progress_.is_inited_); + databuff_printf(event_buf_, sizeof(event_buf_), pos, "is_inited:%d,real_finish_cnt:%ld", + progress_.is_inited_, progress_.real_finish_cnt_); } cells[i].set_varchar(event_buf_); cells[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); diff --git a/src/rootserver/freeze/ob_major_merge_progress_checker.cpp b/src/rootserver/freeze/ob_major_merge_progress_checker.cpp index 98474cdc37..f58d355c62 100644 --- a/src/rootserver/freeze/ob_major_merge_progress_checker.cpp +++ b/src/rootserver/freeze/ob_major_merge_progress_checker.cpp @@ -906,8 +906,10 @@ int ObMajorMergeProgressChecker::generate_tablet_status_map() // source ls meta has been deleted, but source tablet meta has not been deleted yet. ret = OB_SUCCESS; // ignore ret filter = true; - LOG_INFO("ignore this tablet replica, sicne it is not in ls_info", K_(tenant_id), + if (REACH_TIME_INTERVAL(10_s)) { + LOG_INFO("ignore this tablet replica, sicne it is not in ls_info", K_(tenant_id), KPC(replica), K(ls_info)); + } } else { LOG_WARN("fail to find ls replica", KR(ret), KPC(replica), K_(tenant_id)); } diff --git a/src/storage/compaction/ob_compaction_suggestion.cpp b/src/storage/compaction/ob_compaction_suggestion.cpp index 798b652b90..bfbebd838c 100644 --- a/src/storage/compaction/ob_compaction_suggestion.cpp +++ b/src/storage/compaction/ob_compaction_suggestion.cpp @@ -247,6 +247,15 @@ void ObCompactionDagStatus::update_finish_cnt( } } +int64_t ObCompactionDagStatus::get_cost_long_time(const int64_t prio) +{ + int64_t ret_time = INT64_MAX; + if (0 < prio && COMPACTION_PRIORITY_MAX > prio) { + ret_time = COST_LONG_TIME[prio]; + } + return ret_time; +} + /* * ObCompactionSuggestionMgr implement * */ @@ -498,7 +507,7 @@ int ObCompactionSuggestionMgr::analyze_merge_info( int64_t *scan_row_array = nullptr; bool need_suggestion = false; const int64_t buf_len = OB_DIAGNOSE_INFO_LENGTH; - if (ObCompactionDagStatus::COMPACTION_DAG_MAX > type && ObCompactionDagStatus::COST_LONG_TIME[type] <= cost_time) { + if (ObCompactionDagStatus::get_cost_long_time(OB_DAG_TYPES[type].init_dag_prio_) <= cost_time) { ADD_COMPACTION_INFO_PARAM(buf, buf_len, "reason", get_suggestion_reason(ObCompactionSuggestionReason::DAG_COST_LONGTIME)); if (TOO_MANY_FAILED_COUNT <= merge_info.retry_cnt_) { diff --git a/src/storage/compaction/ob_compaction_suggestion.h b/src/storage/compaction/ob_compaction_suggestion.h index 499a16a853..f4b3357be1 100644 --- a/src/storage/compaction/ob_compaction_suggestion.h +++ b/src/storage/compaction/ob_compaction_suggestion.h @@ -191,7 +191,7 @@ struct ObCompactionDagStatus final // for mini/minor/major merge static constexpr int64_t COST_LONG_TIME[COMPACTION_PRIORITY_MAX] = { 10 * 60 * 1000 * 1000L, INT64_MAX, 20 * 60 * 1000 * 1000L, INT64_MAX, 60 * 60 * 1000 * 1000L}; // 10m,30m,60m - + static int64_t get_cost_long_time(const int64_t prio); ObCompactionHistogramStat histogram_stat_[COMPACTION_DAG_MAX]; }; diff --git a/src/storage/compaction/ob_medium_compaction_func.cpp b/src/storage/compaction/ob_medium_compaction_func.cpp index 9c311dd98b..fc64595f14 100644 --- a/src/storage/compaction/ob_medium_compaction_func.cpp +++ b/src/storage/compaction/ob_medium_compaction_func.cpp @@ -1100,7 +1100,7 @@ int ObMediumCompactionScheduleFunc::check_medium_checksum( if (prev_item.is_key_valid()) { if (curr_item.is_same_tablet(prev_item)) { // same tablet if (OB_TMP_FAIL(curr_item.verify_checksum(prev_item))) { - LOG_DBA_ERROR(OB_CHECKSUM_ERROR, "msg", "checksum error in tablet replica checksum", KR(ret), + LOG_DBA_ERROR(OB_CHECKSUM_ERROR, "msg", "checksum error in tablet replica checksum", KR(tmp_ret), K(curr_item), K(prev_item)); if (OB_SUCCESS == check_ret) { if (OB_TMP_FAIL(error_pairs.push_back(ObTabletLSPair(curr_item.tablet_id_, curr_item.ls_id_)))) { diff --git a/src/storage/compaction/ob_tenant_compaction_progress.cpp b/src/storage/compaction/ob_tenant_compaction_progress.cpp index c49336c0b4..3d224dfd7d 100644 --- a/src/storage/compaction/ob_tenant_compaction_progress.cpp +++ b/src/storage/compaction/ob_tenant_compaction_progress.cpp @@ -83,6 +83,7 @@ ObTenantCompactionProgress & ObTenantCompactionProgress::operator=(const ObTenan sum_time_guard_ = other.sum_time_guard_; start_cg_idx_ = other.start_cg_idx_; end_cg_idx_ = other.end_cg_idx_; + real_finish_cnt_ = other.real_finish_cnt_; return *this; } @@ -381,6 +382,7 @@ int ObTenantCompactionProgressMgr::update_progress( } else { array_[pos].unfinished_tablet_cnt_--; } + array_[pos].real_finish_cnt_++; } array_[pos].data_size_ += total_data_size_delta; @@ -445,6 +447,7 @@ int ObTenantCompactionProgressMgr::update_unfinish_tablet(const int64_t major_sn } } else { array_[pos].unfinished_tablet_cnt_--; + array_[pos].real_finish_cnt_++; } } return ret; diff --git a/src/storage/compaction/ob_tenant_compaction_progress.h b/src/storage/compaction/ob_tenant_compaction_progress.h index 70ee887d79..bbe6d6d592 100644 --- a/src/storage/compaction/ob_tenant_compaction_progress.h +++ b/src/storage/compaction/ob_tenant_compaction_progress.h @@ -73,17 +73,19 @@ struct ObTenantCompactionProgress : public ObCompactionProgress is_inited_(false), total_tablet_cnt_(0), unfinished_tablet_cnt_(0), + real_finish_cnt_(0), sum_time_guard_() { } bool is_valid() const; ObTenantCompactionProgress & operator=(const ObTenantCompactionProgress &other); INHERIT_TO_STRING_KV("ObCompactionProgress", ObCompactionProgress, K_(is_inited), K_(total_tablet_cnt), - K_(unfinished_tablet_cnt), K_(sum_time_guard)); + K_(unfinished_tablet_cnt), K_(real_finish_cnt), K_(sum_time_guard)); bool is_inited_; int64_t total_tablet_cnt_; int64_t unfinished_tablet_cnt_; + int64_t real_finish_cnt_; ObStorageCompactionTimeGuard sum_time_guard_; };