From bf8f5cca346ae2920facafce85f395301536efd0 Mon Sep 17 00:00:00 2001 From: starlord Date: Fri, 26 Jul 2019 12:26:45 +0800 Subject: [PATCH] MS-260 Refine log Former-commit-id: a67b4e677a6ad1b46a793119d19a6da85f2441c4 --- cpp/src/db/DBImpl.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cpp/src/db/DBImpl.cpp b/cpp/src/db/DBImpl.cpp index 9a27f09b3d..26a0c9f57e 100644 --- a/cpp/src/db/DBImpl.cpp +++ b/cpp/src/db/DBImpl.cpp @@ -418,13 +418,15 @@ Status DBImpl::BackgroundMergeFiles(const std::string& table_id) { bool has_merge = false; for (auto& kv : raw_files) { auto files = kv.second; - if (files.size() <= options_.merge_trigger_number) { + if (files.size() < options_.merge_trigger_number) { + ENGINE_LOG_DEBUG << "Files number not greater equal than merge trigger number, skip merge action"; continue; } has_merge = true; MergeFiles(table_id, kv.first, kv.second); if (shutting_down_.load(std::memory_order_acquire)){ + ENGINE_LOG_DEBUG << "Server will shutdown, skip merge action for table " << table_id; break; } } @@ -442,6 +444,11 @@ void DBImpl::BackgroundCompaction(std::set table_ids) { ENGINE_LOG_ERROR << "Merge files for table " << table_id << " failed: " << status.ToString(); continue;//let other table get chance to merge } + + if (shutting_down_.load(std::memory_order_acquire)){ + ENGINE_LOG_DEBUG << "Server will shutdown, skip merge action"; + break; + } } meta_ptr_->Archive(); @@ -575,6 +582,11 @@ Status DBImpl::BuildIndexByTable(const std::string& table_id) { return status; } ENGINE_LOG_DEBUG << "Sync building index for " << file.id_ << " passed"; + + if (shutting_down_.load(std::memory_order_acquire)){ + ENGINE_LOG_DEBUG << "Server will shutdown, skip build index action for table " << table_id; + break; + } } return status; @@ -595,6 +607,7 @@ void DBImpl::BackgroundBuildIndex() { } if (shutting_down_.load(std::memory_order_acquire)){ + ENGINE_LOG_DEBUG << "Server will shutdown, skip build index action"; break; } }