From 43890ffd3a8a0331471c7a976786a112a00903cf Mon Sep 17 00:00:00 2001 From: Luwei <814383175@qq.com> Date: Tue, 28 May 2024 15:57:54 +0800 Subject: [PATCH] [fix](compaction) fix repeatedly picking tablets with disable auto compaction (#35472) (#35505) pick master #35472 --- be/src/olap/olap_server.cpp | 13 +++---------- be/src/olap/tablet_manager.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/be/src/olap/olap_server.cpp b/be/src/olap/olap_server.cpp index b667a80490..3d4693c2e6 100644 --- a/be/src/olap/olap_server.cpp +++ b/be/src/olap/olap_server.cpp @@ -898,17 +898,10 @@ std::vector StorageEngine::_generate_compaction_tasks( : copied_base_map[data_dir], &disk_max_score, _cumulative_compaction_policies); if (tablet != nullptr) { - if (!tablet->tablet_meta()->tablet_schema()->disable_auto_compaction()) { - if (need_pick_tablet) { - tablets_compaction.emplace_back(tablet); - } - max_compaction_score = std::max(max_compaction_score, disk_max_score); - } else { - LOG_EVERY_N(INFO, 500) - << "Tablet " << tablet->tablet_id() - << " will be ignored by automatic compaction tasks since it's " - << "set to disabled automatic compaction."; + if (need_pick_tablet) { + tablets_compaction.emplace_back(tablet); } + max_compaction_score = std::max(max_compaction_score, disk_max_score); } } } diff --git a/be/src/olap/tablet_manager.cpp b/be/src/olap/tablet_manager.cpp index cf3c94f2a3..f4b20e99ad 100644 --- a/be/src/olap/tablet_manager.cpp +++ b/be/src/olap/tablet_manager.cpp @@ -728,6 +728,13 @@ TabletSharedPtr TabletManager::find_best_tablet_to_compaction( uint32_t compaction_score = 0; TabletSharedPtr best_tablet; auto handler = [&](const TabletSharedPtr& tablet_ptr) { + if (tablet_ptr->tablet_meta()->tablet_schema()->disable_auto_compaction()) { + LOG_EVERY_N(INFO, 500) << "Tablet " << tablet_ptr->tablet_id() + << " will be ignored by automatic compaction tasks since it's " + << "set to disabled automatic compaction."; + return; + } + if (config::enable_skip_tablet_compaction && tablet_ptr->should_skip_compaction(compaction_type, UnixSeconds())) { return;