From 1d9bac4d7f2e66f056f0ac21753f5c0e7379e1bf Mon Sep 17 00:00:00 2001 From: Naman Gupta Date: Fri, 15 Nov 2013 17:17:13 -0800 Subject: [PATCH] Use sanitized options while opening db Summary: We use SanitizeOptions() to set appropriate values for some options, based on other options. So we should use the sanitized options by default. Luckily it hasn't caused a bug yet, but can result in a bug in the fugture. Test Plan: make check Reviewers: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D14103 --- db/db_impl.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index ed5853336..b50eb4c44 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3808,13 +3808,13 @@ Status DB::Open(const Options& options, const std::string& dbname, DB** dbptr) { uint64_t new_log_number = impl->versions_->NewFileNumber(); unique_ptr lfile; soptions.use_mmap_writes = false; - s = options.env->NewWritableFile( + s = impl->options_.env->NewWritableFile( LogFileName(impl->options_.wal_dir, new_log_number), &lfile, soptions ); if (s.ok()) { - lfile->SetPreallocationBlockSize(1.1 * options.write_buffer_size); + lfile->SetPreallocationBlockSize(1.1 * impl->options_.write_buffer_size); edit.SetLogNumber(new_log_number); impl->logfile_number_ = new_log_number; impl->log_.reset(new log::Writer(std::move(lfile))); @@ -3830,7 +3830,7 @@ Status DB::Open(const Options& options, const std::string& dbname, DB** dbptr) { } impl->mutex_.Unlock(); - if (options.compaction_style == kCompactionStyleUniversal) { + if (impl->options_.compaction_style == kCompactionStyleUniversal) { int num_files; for (int i = 1; i < impl->NumberLevels(); i++) { num_files = impl->versions_->NumLevelFiles(i);