Rename DBImpl::log_dir_unsynced_ to log_dir_synced_

Summary: log_dir_unsynced_ is a confusing name. Rename it to log_dir_synced_ and flip the value.

Test Plan: Run ./fault_injection_test

Reviewers: rven, yhchiang, igor

Reviewed By: igor

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D32235
main
sdong 10 years ago
parent c1de6c42a0
commit be8f0b12ed
  1. 8
      db/db_impl.cc
  2. 2
      db/db_impl.h

@ -201,7 +201,7 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname)
shutting_down_(false),
bg_cv_(&mutex_),
logfile_number_(0),
log_dir_unsynced_(true),
log_dir_synced_(false),
log_empty_(true),
default_cf_handle_(nullptr),
total_log_size_(0),
@ -3101,13 +3101,13 @@ Status DBImpl::Write(const WriteOptions& write_options, WriteBatch* my_batch) {
} else {
status = log_->file()->Sync();
}
if (status.ok() && log_dir_unsynced_) {
if (status.ok() && !log_dir_synced_) {
// We only sync WAL directory the first time WAL syncing is
// requested, so that in case users never turn on WAL sync,
// we can avoid the disk I/O in the write code path.
status = directories_.GetWalDir()->Fsync();
}
log_dir_unsynced_ = false;
log_dir_synced_ = true;
}
}
if (status.ok()) {
@ -3250,7 +3250,7 @@ Status DBImpl::SetNewMemtableAndNewLogFile(ColumnFamilyData* cfd,
lfile->SetPreallocationBlockSize(
1.1 * mutable_cf_options.write_buffer_size);
new_log = new log::Writer(std::move(lfile));
log_dir_unsynced_ = true;
log_dir_synced_ = false;
}
}

@ -422,7 +422,7 @@ class DBImpl : public DB {
port::CondVar bg_cv_;
uint64_t logfile_number_;
unique_ptr<log::Writer> log_;
bool log_dir_unsynced_;
bool log_dir_synced_;
bool log_empty_;
ColumnFamilyHandleImpl* default_cf_handle_;
InternalStats* default_cf_internal_stats_;

Loading…
Cancel
Save