From b24fab48cd810080fa64bc1dd9c1da6771fb6d5f Mon Sep 17 00:00:00 2001 From: Mingyu Chen Date: Wed, 15 May 2019 18:47:08 +0800 Subject: [PATCH] Add some logs for compaction process (#1163) --- be/src/olap/olap_engine.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/be/src/olap/olap_engine.cpp b/be/src/olap/olap_engine.cpp index 19a62d7c8e..d140f357c0 100644 --- a/be/src/olap/olap_engine.cpp +++ b/be/src/olap/olap_engine.cpp @@ -1842,11 +1842,14 @@ void OLAPEngine::perform_cumulative_compaction(OlapStore* store) { OLAPStatus res = cumulative_compaction.init(best_table); if (res != OLAP_SUCCESS) { if (res != OLAP_ERR_CUMULATIVE_REPEAT_INIT && res != OLAP_ERR_CE_TRY_CE_LOCK_ERROR) { - DorisMetrics::cumulative_compaction_request_failed.increment(1); best_table->set_last_compaction_failure_time(UnixMillis()); LOG(WARNING) << "failed to init cumulative compaction" << ", table=" << best_table->full_name() << ", res=" << res; + + if (res != OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSIONS) { + DorisMetrics::cumulative_compaction_request_failed.increment(1); + } } return; } @@ -1905,6 +1908,12 @@ OLAPTablePtr OLAPEngine::_find_best_tablet_to_compaction(CompactionType compacti continue; } + if (now - table_ptr->last_compaction_failure_time() <= config::min_compaction_failure_interval_sec * 1000) { + LOG(INFO) << "tablet last compaction failure time is: " << table_ptr->last_compaction_failure_time() + << ", tablet: " << table_ptr->tablet_id() << ", skip it."; + continue; + } + if (compaction_type == CompactionType::CUMULATIVE_COMPACTION) { if (!table_ptr->try_cumulative_lock()) { continue; @@ -1920,12 +1929,6 @@ OLAPTablePtr OLAPEngine::_find_best_tablet_to_compaction(CompactionType compacti table_ptr->release_base_compaction_lock(); } } - - if (now - table_ptr->last_compaction_failure_time() <= config::min_compaction_failure_interval_sec * 1000) { - LOG(INFO) << "tablet last compaction failure time is: " << table_ptr->last_compaction_failure_time() - << ", skip it"; - continue; - } ReadLock rdlock(table_ptr->get_header_lock_ptr()); uint32_t table_score = 0; @@ -1940,6 +1943,11 @@ OLAPTablePtr OLAPEngine::_find_best_tablet_to_compaction(CompactionType compacti } } } + + if (best_table != nullptr) { + LOG(INFO) << "find best tablet to do compaction. type: " << (compaction_type == CompactionType::CUMULATIVE_COMPACTION ? "cumulative" : "base") + << ", tablet id: " << best_table->tablet_id() << ", score: " << highest_score; + } return best_table; }