Apply InfoLogLevel to the logs in util/db_info_dumper.cc

Summary:
* Rename util/db_info_dummper.cc to util/db_info_dumper.cc
* Apply InfoLogLevel to the logs in util/db_info_dumper.cc

Test Plan: make

Reviewers: ljin, sdong, igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D27915
This commit is contained in:
Yueh-Hsuan Chiang 2014-10-30 13:34:44 -07:00
parent fda592d902
commit 73605d9179

View File

@ -36,10 +36,11 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
uint64_t file_size;
std::string file_info, wal_info;
Log(options.info_log, "DB SUMMARY\n");
Log(InfoLogLevel::INFO_LEVEL, options.info_log, "DB SUMMARY\n");
// Get files in dbname dir
if (!env->GetChildren(dbname, &files).ok()) {
Log(options.info_log, "Error when reading %s dir\n", dbname.c_str());
Log(InfoLogLevel::ERROR_LEVEL,
options.info_log, "Error when reading %s dir\n", dbname.c_str());
}
std::sort(files.begin(), files.end());
for (std::string file : files) {
@ -48,14 +49,17 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
}
switch (type) {
case kCurrentFile:
Log(options.info_log, "CURRENT file: %s\n", file.c_str());
Log(InfoLogLevel::INFO_LEVEL, options.info_log,
"CURRENT file: %s\n", file.c_str());
break;
case kIdentityFile:
Log(options.info_log, "IDENTITY file: %s\n", file.c_str());
Log(InfoLogLevel::INFO_LEVEL, options.info_log,
"IDENTITY file: %s\n", file.c_str());
break;
case kDescriptorFile:
env->GetFileSize(dbname + "/" + file, &file_size);
Log(options.info_log, "MANIFEST file: %s size: %" PRIu64 " Bytes\n",
Log(InfoLogLevel::INFO_LEVEL, options.info_log,
"MANIFEST file: %s size: %" PRIu64 " Bytes\n",
file.c_str(), file_size);
break;
case kLogFile:
@ -79,7 +83,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
for (auto& db_path : options.db_paths) {
if (dbname.compare(db_path.path) != 0) {
if (!env->GetChildren(db_path.path, &files).ok()) {
Log(options.info_log, "Error when reading %s dir\n",
Log(InfoLogLevel::ERROR_LEVEL, options.info_log,
"Error when reading %s dir\n",
db_path.path.c_str());
continue;
}
@ -92,7 +97,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
}
}
}
Log(options.info_log, "SST files in %s dir, Total Num: %" PRIu64 ", files: %s\n",
Log(InfoLogLevel::INFO_LEVEL, options.info_log,
"SST files in %s dir, Total Num: %" PRIu64 ", files: %s\n",
db_path.path.c_str(), file_num, file_info.c_str());
file_num = 0;
file_info.clear();
@ -101,7 +107,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
// Get wal file in wal_dir
if (dbname.compare(options.wal_dir) != 0) {
if (!env->GetChildren(options.wal_dir, &files).ok()) {
Log(options.info_log, "Error when reading %s dir\n",
Log(InfoLogLevel::ERROR_LEVEL, options.info_log,
"Error when reading %s dir\n",
options.wal_dir.c_str());
return;
}
@ -118,7 +125,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
}
}
}
Log(options.info_log, "Write Ahead Log file in %s: %s\n",
Log(InfoLogLevel::INFO_LEVEL, options.info_log,
"Write Ahead Log file in %s: %s\n",
options.wal_dir.c_str(), wal_info.c_str());
}
} // namespace rocksdb