acelyc111 commented on a change in pull request #5592: URL: https://github.com/apache/incubator-doris/pull/5592#discussion_r605681873
########## File path: be/src/olap/olap_server.cpp ########## @@ -386,20 +386,30 @@ void StorageEngine::_compaction_tasks_producer_callback() { std::vector<TabletSharedPtr> StorageEngine::_compaction_tasks_generator( CompactionType compaction_type, std::vector<DataDir*> data_dirs) { std::vector<TabletSharedPtr> tablets_compaction; + uint32_t max_compaction_score = 0; std::random_shuffle(data_dirs.begin(), data_dirs.end()); for (auto data_dir : data_dirs) { std::unique_lock<std::mutex> lock(_tablet_submitted_compaction_mutex); if (_tablet_submitted_compaction[data_dir].size() >= config::compaction_task_num_per_disk) { continue; } if (!data_dir->reach_capacity_limit(0)) { + uint32_t disk_max_score = 0; TabletSharedPtr tablet = _tablet_manager->find_best_tablet_to_compaction( - compaction_type, data_dir, _tablet_submitted_compaction[data_dir]); + compaction_type, data_dir, _tablet_submitted_compaction[data_dir], disk_max_score); if (tablet != nullptr) { tablets_compaction.emplace_back(tablet); + max_compaction_score = disk_max_score > max_compaction_score ? disk_max_score : max_compaction_score; Review comment: ```suggestion max_compaction_score = std::max(max_compaction_score, disk_max_score); ``` ########## File path: be/src/olap/olap_server.cpp ########## @@ -386,20 +386,30 @@ void StorageEngine::_compaction_tasks_producer_callback() { std::vector<TabletSharedPtr> StorageEngine::_compaction_tasks_generator( CompactionType compaction_type, std::vector<DataDir*> data_dirs) { std::vector<TabletSharedPtr> tablets_compaction; + uint32_t max_compaction_score = 0; std::random_shuffle(data_dirs.begin(), data_dirs.end()); for (auto data_dir : data_dirs) { std::unique_lock<std::mutex> lock(_tablet_submitted_compaction_mutex); if (_tablet_submitted_compaction[data_dir].size() >= config::compaction_task_num_per_disk) { continue; } if (!data_dir->reach_capacity_limit(0)) { + uint32_t disk_max_score = 0; TabletSharedPtr tablet = _tablet_manager->find_best_tablet_to_compaction( - compaction_type, data_dir, _tablet_submitted_compaction[data_dir]); + compaction_type, data_dir, _tablet_submitted_compaction[data_dir], disk_max_score); if (tablet != nullptr) { tablets_compaction.emplace_back(tablet); + max_compaction_score = disk_max_score > max_compaction_score ? disk_max_score : max_compaction_score; } } } + if (tablets_compaction.size() > 0) { Review comment: ```suggestion if (!tablets_compaction.empty()) { ``` or `max_compaction_score > 0` ? ########## File path: be/src/olap/tablet_manager.h ########## @@ -71,7 +71,7 @@ class TabletManager { TabletSharedPtr find_best_tablet_to_compaction(CompactionType compaction_type, DataDir* data_dir, - vector<TTabletId>& tablet_submitted_compaction); + vector<TTabletId>& tablet_submitted_compaction, uint32_t& score); Review comment: ```suggestion vector<TTabletId>& tablet_submitted_compaction, uint32_t& score); ``` -- 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