morningman commented on a change in pull request #4837: URL: https://github.com/apache/incubator-doris/pull/4837#discussion_r519184314
########## File path: docs/zh-CN/administrator-guide/config/be_config.md ########## @@ -180,6 +180,10 @@ Metrics: {"filtered_rows":0,"input_row_num":3346807,"input_rowsets_count":42,"in ### `column_dictionary_key_size_threshold` +### `compaction_tablet_compaction_score_factor` Review comment: Why no document for these 2 configs? Better give best practice for them. ########## File path: be/src/olap/tablet_manager.cpp ########## @@ -745,17 +747,22 @@ TabletSharedPtr TabletManager::find_best_tablet_to_compaction( } } - uint32_t table_score = 0; + double tablet_score = 0; + uint32_t current_compaction_score = 0; { ReadLock rdlock(tablet_ptr->get_header_lock_ptr()); if (compaction_type == CompactionType::BASE_COMPACTION) { - table_score = tablet_ptr->calc_base_compaction_score(); + current_compaction_score = tablet_ptr->calc_base_compaction_score(); } else if (compaction_type == CompactionType::CUMULATIVE_COMPACTION) { - table_score = tablet_ptr->calc_cumulative_compaction_score(); + current_compaction_score = tablet_ptr->calc_cumulative_compaction_score(); } } - if (table_score > highest_score) { - highest_score = table_score; + double scan_frequency = tablet_ptr->calculate_scan_frequency(); Review comment: if `compaction_tablet_scan_frequency_factor` is zero, we can skip calling `calculate_scan_frequency()` to save some CPU. ########## File path: be/src/olap/tablet.cpp ########## @@ -1309,4 +1311,16 @@ void Tablet::generate_tablet_meta_copy_unlocked(TabletMetaSharedPtr new_tablet_m new_tablet_meta->init_from_pb(tablet_meta_pb); } +double Tablet::calculate_scan_frequency() { + time_t now = time(nullptr); + int64_t current_count = query_scan_count->value(); + double interval = difftime(now, _last_record_scan_count_timestamp); + double scan_frequency = (current_count - _last_record_scan_count) * 60 / interval; Review comment: Why multi 60? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org