Apply InfoLogLevel to the logs in db/db_filesnapshot.cc

Summary: Apply InfoLogLevel to the logs in db/db_filesnapshot.cc

Test Plan: make

Reviewers: ljin, sdong, rven, igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D27813
This commit is contained in:
Yueh-Hsuan Chiang 2014-10-29 14:06:14 -07:00
parent 2d4fe048f4
commit 7b3a618f94

View File

@ -32,9 +32,10 @@ Status DBImpl::DisableFileDeletions() {
MutexLock l(&mutex_); MutexLock l(&mutex_);
++disable_delete_obsolete_files_; ++disable_delete_obsolete_files_;
if (disable_delete_obsolete_files_ == 1) { if (disable_delete_obsolete_files_ == 1) {
Log(db_options_.info_log, "File Deletions Disabled"); Log(InfoLogLevel::INFO_LEVEL, db_options_.info_log,
"File Deletions Disabled");
} else { } else {
Log(db_options_.info_log, Log(InfoLogLevel::WARN_LEVEL, db_options_.info_log,
"File Deletions Disabled, but already disabled. Counter: %d", "File Deletions Disabled, but already disabled. Counter: %d",
disable_delete_obsolete_files_); disable_delete_obsolete_files_);
} }
@ -53,11 +54,12 @@ Status DBImpl::EnableFileDeletions(bool force) {
--disable_delete_obsolete_files_; --disable_delete_obsolete_files_;
} }
if (disable_delete_obsolete_files_ == 0) { if (disable_delete_obsolete_files_ == 0) {
Log(db_options_.info_log, "File Deletions Enabled"); Log(InfoLogLevel::INFO_LEVEL, db_options_.info_log,
"File Deletions Enabled");
should_purge_files = true; should_purge_files = true;
FindObsoleteFiles(&job_context, true); FindObsoleteFiles(&job_context, true);
} else { } else {
Log(db_options_.info_log, Log(InfoLogLevel::WARN_LEVEL, db_options_.info_log,
"File Deletions Enable, but not really enabled. Counter: %d", "File Deletions Enable, but not really enabled. Counter: %d",
disable_delete_obsolete_files_); disable_delete_obsolete_files_);
} }
@ -98,8 +100,8 @@ Status DBImpl::GetLiveFiles(std::vector<std::string>& ret,
if (!status.ok()) { if (!status.ok()) {
mutex_.Unlock(); mutex_.Unlock();
Log(db_options_.info_log, "Cannot Flush data %s\n", Log(InfoLogLevel::ERROR_LEVEL, db_options_.info_log,
status.ToString().c_str()); "Cannot Flush data %s\n", status.ToString().c_str());
return status; return status;
} }
} }
@ -160,8 +162,8 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
uint64_t latest_archived_log_number = 0; uint64_t latest_archived_log_number = 0;
if (!files.empty()) { if (!files.empty()) {
latest_archived_log_number = files.back()->LogNumber(); latest_archived_log_number = files.back()->LogNumber();
Log(db_options_.info_log, "Latest Archived log: %" PRIu64, Log(InfoLogLevel::INFO_LEVEL, db_options_.info_log,
latest_archived_log_number); "Latest Archived log: %" PRIu64, latest_archived_log_number);
} }
files.reserve(files.size() + logs.size()); files.reserve(files.size() + logs.size());
@ -173,8 +175,8 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
// same log in both db dir and archived dir. Simply // same log in both db dir and archived dir. Simply
// ignore the one in db dir. Note that, if we read // ignore the one in db dir. Note that, if we read
// archived dir first, we would have missed the log file. // archived dir first, we would have missed the log file.
Log(db_options_.info_log, "%s already moved to archive", Log(InfoLogLevel::WARN_LEVEL, db_options_.info_log,
log->PathName().c_str()); "%s already moved to archive", log->PathName().c_str());
} }
} }