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
main
Yueh-Hsuan Chiang 10 years ago
parent fda592d902
commit 73605d9179
  1. 26
      util/db_info_dumper.cc

@ -36,10 +36,11 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
uint64_t file_size; uint64_t file_size;
std::string file_info, wal_info; 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 // Get files in dbname dir
if (!env->GetChildren(dbname, &files).ok()) { 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()); std::sort(files.begin(), files.end());
for (std::string file : files) { for (std::string file : files) {
@ -48,14 +49,17 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
} }
switch (type) { switch (type) {
case kCurrentFile: 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; break;
case kIdentityFile: 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; break;
case kDescriptorFile: case kDescriptorFile:
env->GetFileSize(dbname + "/" + file, &file_size); 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); file.c_str(), file_size);
break; break;
case kLogFile: case kLogFile:
@ -79,7 +83,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
for (auto& db_path : options.db_paths) { for (auto& db_path : options.db_paths) {
if (dbname.compare(db_path.path) != 0) { if (dbname.compare(db_path.path) != 0) {
if (!env->GetChildren(db_path.path, &files).ok()) { 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()); db_path.path.c_str());
continue; 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()); db_path.path.c_str(), file_num, file_info.c_str());
file_num = 0; file_num = 0;
file_info.clear(); file_info.clear();
@ -101,7 +107,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
// Get wal file in wal_dir // Get wal file in wal_dir
if (dbname.compare(options.wal_dir) != 0) { if (dbname.compare(options.wal_dir) != 0) {
if (!env->GetChildren(options.wal_dir, &files).ok()) { 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()); options.wal_dir.c_str());
return; 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()); options.wal_dir.c_str(), wal_info.c_str());
} }
} // namespace rocksdb } // namespace rocksdb
Loading…
Cancel
Save