From fd5d80d55e9bcb8c0dd4b6200937e0727fd4b819 Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Mon, 29 Sep 2014 12:45:04 -0700 Subject: [PATCH] CompactedDB: log using the correct info_log Summary: info_log from supplied Options can be nullptr. Using the one from db_impl. Also call flush after that since no more loggging will happen and LOG can contain partial output Test Plan: verified with db_bench Reviewers: igor, yhchiang, sdong Reviewed By: sdong Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D24183 --- db/db_impl_readonly.cc | 3 ++- utilities/compacted_db/compacted_db_impl.cc | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/db/db_impl_readonly.cc b/db/db_impl_readonly.cc index 98e2bfeb0..9faebd8c2 100644 --- a/db/db_impl_readonly.cc +++ b/db/db_impl_readonly.cc @@ -14,7 +14,8 @@ namespace rocksdb { DBImplReadOnly::DBImplReadOnly(const DBOptions& db_options, const std::string& dbname) : DBImpl(db_options, dbname) { - Log(db_options_.info_log, "Opening the db in read only mode"); + Log(INFO_LEVEL, db_options_.info_log, "Opening the db in read only mode"); + LogFlush(db_options_.info_log); } DBImplReadOnly::~DBImplReadOnly() { diff --git a/utilities/compacted_db/compacted_db_impl.cc b/utilities/compacted_db/compacted_db_impl.cc index 70ddb27cf..775033e2a 100644 --- a/utilities/compacted_db/compacted_db_impl.cc +++ b/utilities/compacted_db/compacted_db_impl.cc @@ -144,8 +144,10 @@ Status CompactedDBImpl::Open(const Options& options, std::unique_ptr db(new CompactedDBImpl(db_options, dbname)); Status s = db->Init(options); if (s.ok()) { + Log(INFO_LEVEL, db->db_options_.info_log, + "Opened the db as fully compacted mode"); + LogFlush(db->db_options_.info_log); *dbptr = db.release(); - Log(options.info_log, "Opened the db as fully compacted mode"); } return s; }