MS-260 Refine log

Former-commit-id: a67b4e677a6ad1b46a793119d19a6da85f2441c4
pull/191/head
starlord 2019-07-26 12:26:45 +08:00
parent d98f0549b2
commit bf8f5cca34
1 changed files with 14 additions and 1 deletions

View File

@ -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<std::string> 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;
}
}