rename options_ to db_options_ in DBImpl to avoid confusion

Summary: as title

Test Plan: make release

Reviewers: sdong, igor

Reviewed By: igor

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D22935
This commit is contained in:
Lei Jin 2014-09-05 11:48:17 -07:00
parent 5cd0576ffe
commit c9e419ccb6
4 changed files with 188 additions and 179 deletions

View File

@ -32,9 +32,9 @@ Status DBImpl::DisableFileDeletions() {
MutexLock l(&mutex_); MutexLock l(&mutex_);
++disable_delete_obsolete_files_; ++disable_delete_obsolete_files_;
if (disable_delete_obsolete_files_ == 1) { if (disable_delete_obsolete_files_ == 1) {
Log(options_.info_log, "File Deletions Disabled"); Log(db_options_.info_log, "File Deletions Disabled");
} else { } else {
Log(options_.info_log, Log(db_options_.info_log,
"File Deletions Disabled, but already disabled. Counter: %d", "File Deletions Disabled, but already disabled. Counter: %d",
disable_delete_obsolete_files_); disable_delete_obsolete_files_);
} }
@ -53,11 +53,11 @@ Status DBImpl::EnableFileDeletions(bool force) {
--disable_delete_obsolete_files_; --disable_delete_obsolete_files_;
} }
if (disable_delete_obsolete_files_ == 0) { if (disable_delete_obsolete_files_ == 0) {
Log(options_.info_log, "File Deletions Enabled"); Log(db_options_.info_log, "File Deletions Enabled");
should_purge_files = true; should_purge_files = true;
FindObsoleteFiles(deletion_state, true); FindObsoleteFiles(deletion_state, true);
} else { } else {
Log(options_.info_log, Log(db_options_.info_log,
"File Deletions Enable, but not really enabled. Counter: %d", "File Deletions Enable, but not really enabled. Counter: %d",
disable_delete_obsolete_files_); disable_delete_obsolete_files_);
} }
@ -65,7 +65,7 @@ Status DBImpl::EnableFileDeletions(bool force) {
if (should_purge_files) { if (should_purge_files) {
PurgeObsoleteFiles(deletion_state); PurgeObsoleteFiles(deletion_state);
} }
LogFlush(options_.info_log); LogFlush(db_options_.info_log);
return Status::OK(); return Status::OK();
} }
@ -98,7 +98,7 @@ Status DBImpl::GetLiveFiles(std::vector<std::string>& ret,
if (!status.ok()) { if (!status.ok()) {
mutex_.Unlock(); mutex_.Unlock();
Log(options_.info_log, "Cannot Flush data %s\n", Log(db_options_.info_log, "Cannot Flush data %s\n",
status.ToString().c_str()); status.ToString().c_str());
return status; return status;
} }
@ -136,7 +136,7 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
Status s; Status s;
// list wal files in main db dir. // list wal files in main db dir.
VectorLogPtr logs; VectorLogPtr logs;
s = GetSortedWalsOfType(options_.wal_dir, logs, kAliveLogFile); s = GetSortedWalsOfType(db_options_.wal_dir, logs, kAliveLogFile);
if (!s.ok()) { if (!s.ok()) {
return s; return s;
} }
@ -149,7 +149,7 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
files.clear(); files.clear();
// list wal files in archive dir. // list wal files in archive dir.
std::string archivedir = ArchivalDirectory(options_.wal_dir); std::string archivedir = ArchivalDirectory(db_options_.wal_dir);
if (env_->FileExists(archivedir)) { if (env_->FileExists(archivedir)) {
s = GetSortedWalsOfType(archivedir, files, kArchivedLogFile); s = GetSortedWalsOfType(archivedir, files, kArchivedLogFile);
if (!s.ok()) { if (!s.ok()) {
@ -160,7 +160,7 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
uint64_t latest_archived_log_number = 0; uint64_t latest_archived_log_number = 0;
if (!files.empty()) { if (!files.empty()) {
latest_archived_log_number = files.back()->LogNumber(); latest_archived_log_number = files.back()->LogNumber();
Log(options_.info_log, "Latest Archived log: %" PRIu64, Log(db_options_.info_log, "Latest Archived log: %" PRIu64,
latest_archived_log_number); latest_archived_log_number);
} }
@ -173,7 +173,7 @@ Status DBImpl::GetSortedWalFiles(VectorLogPtr& files) {
// same log in both db dir and archived dir. Simply // same log in both db dir and archived dir. Simply
// ignore the one in db dir. Note that, if we read // ignore the one in db dir. Note that, if we read
// archived dir first, we would have missed the log file. // archived dir first, we would have missed the log file.
Log(options_.info_log, "%s already moved to archive", Log(db_options_.info_log, "%s already moved to archive",
log->PathName().c_str()); log->PathName().c_str());
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -276,7 +276,7 @@ class DBImpl : public DB {
// Returns the list of live files in 'live' and the list // Returns the list of live files in 'live' and the list
// of all files in the filesystem in 'candidate_files'. // of all files in the filesystem in 'candidate_files'.
// If force == false and the last call was less than // If force == false and the last call was less than
// options_.delete_obsolete_files_period_micros microseconds ago, // db_options_.delete_obsolete_files_period_micros microseconds ago,
// it will not fill up the deletion_state // it will not fill up the deletion_state
void FindObsoleteFiles(DeletionState& deletion_state, void FindObsoleteFiles(DeletionState& deletion_state,
bool force, bool force,
@ -294,7 +294,7 @@ class DBImpl : public DB {
Env* const env_; Env* const env_;
const std::string dbname_; const std::string dbname_;
unique_ptr<VersionSet> versions_; unique_ptr<VersionSet> versions_;
const DBOptions options_; const DBOptions db_options_;
Statistics* stats_; Statistics* stats_;
Iterator* NewInternalIterator(const ReadOptions&, ColumnFamilyData* cfd, Iterator* NewInternalIterator(const ReadOptions&, ColumnFamilyData* cfd,

View File

@ -44,7 +44,7 @@ namespace rocksdb {
DBImplReadOnly::DBImplReadOnly(const DBOptions& options, DBImplReadOnly::DBImplReadOnly(const DBOptions& options,
const std::string& dbname) const std::string& dbname)
: DBImpl(options, dbname) { : DBImpl(options, dbname) {
Log(options_.info_log, "Opening the db in read only mode"); Log(db_options_.info_log, "Opening the db in read only mode");
} }
DBImplReadOnly::~DBImplReadOnly() { DBImplReadOnly::~DBImplReadOnly() {