From 690bf8868246889ef927b097c49a7aabc9c55e4d Mon Sep 17 00:00:00 2001 From: heyongqiang Date: Tue, 28 Aug 2012 11:29:30 -0700 Subject: [PATCH] in db_stats_logger.cc, hold mutex_ while accessing versions_ Summary: as subject Test Plan:db_test Reviewers: dhruba --- db/db_stats_logger.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/db/db_stats_logger.cc b/db/db_stats_logger.cc index c189df91d..575d044a3 100644 --- a/db/db_stats_logger.cc +++ b/db/db_stats_logger.cc @@ -53,14 +53,10 @@ void DBImpl::LogDBDeployStats() { return; } - mutex_.Unlock(); - std::string version_info; version_info += boost::lexical_cast(kMajorVersion); version_info += "."; version_info += boost::lexical_cast(kMinorVersion); - std::string data_dir; - env_->GetAbsolutePath(dbname_, &data_dir); uint64_t file_total_size = 0; uint32_t file_total_num = 0; @@ -75,8 +71,13 @@ void DBImpl::LogDBDeployStats() { const char* file_size_summary = versions_->LevelDataSizeSummary( &scratch); std::string data_size_per_level(file_num_summary); + + mutex_.Unlock(); + int64_t unix_ts; env_->GetCurrentTime(&unix_ts); + std::string data_dir; + env_->GetAbsolutePath(dbname_, &data_dir); logger_->Log_Deploy_Stats(version_info, host_name_, data_dir, file_total_size, file_total_num, file_num_per_level,