From c90c48d3c89141bc8839a0fa69a6b5b2d4f03d08 Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Sat, 29 Oct 2016 16:01:30 -0700 Subject: [PATCH] Show More DB Stats in info logs Summary: DB Stats now are truncated if there are too many CFs. Extend the buffer size to allow more to be printed out. Also, separate out malloc to another log line. Closes https://github.com/facebook/rocksdb/pull/1439 Differential Revision: D4100943 Pulled By: yiwu-arbug fbshipit-source-id: 79f7218 --- db/db_impl.cc | 13 ++++++++++--- util/posix_logger.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index afd372012..db8e9aad5 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -634,13 +634,20 @@ void DBImpl::MaybeDumpStats() { default_cf_internal_stats_->GetStringProperty( *db_property_info, DB::Properties::kDBStats, &stats); } - if (immutable_db_options_.dump_malloc_stats) { - DumpMallocStats(&stats); - } Log(InfoLogLevel::WARN_LEVEL, immutable_db_options_.info_log, "------- DUMPING STATS -------"); Log(InfoLogLevel::WARN_LEVEL, immutable_db_options_.info_log, "%s", stats.c_str()); + if (immutable_db_options_.dump_malloc_stats) { + stats.clear(); + DumpMallocStats(&stats); + if (!stats.empty()) { + Log(InfoLogLevel::WARN_LEVEL, immutable_db_options_.info_log, + "------- Malloc STATS -------"); + Log(InfoLogLevel::WARN_LEVEL, immutable_db_options_.info_log, "%s", + stats.c_str()); + } + } #endif // !ROCKSDB_LITE PrintStatistics(); diff --git a/util/posix_logger.h b/util/posix_logger.h index ddad037e0..9450f3b92 100644 --- a/util/posix_logger.h +++ b/util/posix_logger.h @@ -80,7 +80,7 @@ class PosixLogger : public Logger { bufsize = sizeof(buffer); base = buffer; } else { - bufsize = 30000; + bufsize = 65536; base = new char[bufsize]; } char* p = base;