fix compaction progress timeguard & ignore ls_inner_tablet

This commit is contained in:
a1iive 2023-07-12 04:42:32 +00:00 committed by ob-robot
parent 497b6f6c0f
commit 5b8a4b982a
4 changed files with 12 additions and 9 deletions

View File

@ -282,7 +282,7 @@ public:
if (OB_LIKELY(idx_ < CAPACITY)) {
int64_t now = common::ObTimeUtility::current_time();
line_array_[idx_] = static_cast<uint16_t>(line);
click_poinsts_[idx_] = static_cast<uint32_t>(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

View File

@ -1158,8 +1158,9 @@ int ObCompactionDiagnoseMgr::diagnose_tablet_medium_merge(
ObTabletMemberWrapper<ObTabletTableStore> 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<ObTabletTableStore> 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()) {

View File

@ -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));
}

View File

@ -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];