Skip to content

Commit 1d9bac4

Browse files
committed
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
1 parent fbbf0d1 commit 1d9bac4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

db/db_impl.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -3808,13 +3808,13 @@ Status DB::Open(const Options& options, const std::string& dbname, DB** dbptr) {
38083808
uint64_t new_log_number = impl->versions_->NewFileNumber();
38093809
unique_ptr<WritableFile> lfile;
38103810
soptions.use_mmap_writes = false;
3811-
s = options.env->NewWritableFile(
3811+
s = impl->options_.env->NewWritableFile(
38123812
LogFileName(impl->options_.wal_dir, new_log_number),
38133813
&lfile,
38143814
soptions
38153815
);
38163816
if (s.ok()) {
3817-
lfile->SetPreallocationBlockSize(1.1 * options.write_buffer_size);
3817+
lfile->SetPreallocationBlockSize(1.1 * impl->options_.write_buffer_size);
38183818
edit.SetLogNumber(new_log_number);
38193819
impl->logfile_number_ = new_log_number;
38203820
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) {
38303830
}
38313831
impl->mutex_.Unlock();
38323832

3833-
if (options.compaction_style == kCompactionStyleUniversal) {
3833+
if (impl->options_.compaction_style == kCompactionStyleUniversal) {
38343834
int num_files;
38353835
for (int i = 1; i < impl->NumberLevels(); i++) {
38363836
num_files = impl->versions_->NumLevelFiles(i);

0 commit comments

Comments
 (0)