From: Sage Weil Date: Wed, 2 Dec 2015 20:06:37 +0000 (-0500) Subject: debug log_writer X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b742a31188a02c4a46bbf9750f7b1b233892a01d;p=rocksdb.git debug log_writer --- diff --git a/db/db_impl.cc b/db/db_impl.cc index 56a96a67..22b42b18 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -4255,8 +4255,10 @@ Status DBImpl::SwitchMemtable(ColumnFamilyData* cfd, WriteContext* context) { mutable_cf_options.write_buffer_size); unique_ptr file_writer( new WritableFileWriter(std::move(lfile), opt_env_opt)); - new_log = new log::Writer(std::move(file_writer), new_log_number, - db_options_.recycle_log_file_num > 0); + new_log = new log::Writer(std::move(file_writer), + new_log_number, + db_options_.recycle_log_file_num > 0, + &db_options); } } diff --git a/db/log_writer.cc b/db/log_writer.cc index 6ba28565..728c526b 100644 --- a/db/log_writer.cc +++ b/db/log_writer.cc @@ -19,8 +19,10 @@ namespace rocksdb { namespace log { Writer::Writer(unique_ptr&& dest, - uint64_t log_number, bool recycle_log_files) - : dest_(std::move(dest)), + uint64_t log_number, bool recycle_log_files, + const DBOptions *opt) + : db_options_(opt), + dest_(std::move(dest)), block_offset_(0), log_number_(log_number), recycle_log_files_(recycle_log_files) { diff --git a/db/log_writer.h b/db/log_writer.h index 8f5c3a10..bb0512dc 100644 --- a/db/log_writer.h +++ b/db/log_writer.h @@ -19,6 +19,7 @@ namespace rocksdb { class WritableFileWriter; +class DBOptions; using std::unique_ptr; @@ -73,7 +74,8 @@ class Writer { // "*dest" must be initially empty. // "*dest" must remain live while this Writer is in use. explicit Writer(unique_ptr&& dest, - uint64_t log_number, bool recycle_log_files); + uint64_t log_number, bool recycle_log_files, + const DBOptions *opt = NULL); ~Writer(); Status AddRecord(const Slice& slice); @@ -82,6 +84,7 @@ class Writer { const WritableFileWriter* file() const { return dest_.get(); } private: + const DBOptions *db_options_; unique_ptr dest_; int block_offset_; // Current offset in block uint64_t log_number_;