From 0a88f38b7ec7c3c6b2f86ded4a1891e02277149e Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Fri, 16 Sep 2016 15:09:14 -0700 Subject: [PATCH] Remove ColumnFamilyData::options() Summary: One more small refactor before I split DBOptions into mutable and immutable parts. Test Plan: existing unit tests. Reviewers: yhchiang, IslamAbdelRahman, sdong Reviewed By: sdong Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D64047 --- db/column_family.cc | 5 +---- db/column_family.h | 3 --- db/compaction_job.cc | 4 ++-- db/db_impl.cc | 6 +++--- db/flush_job.cc | 2 +- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/db/column_family.cc b/db/column_family.cc index 673e06a8d..e63455aa2 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -71,10 +71,7 @@ Status ColumnFamilyHandleImpl::GetDescriptor(ColumnFamilyDescriptor* desc) { #ifndef ROCKSDB_LITE // accessing mutable cf-options requires db mutex. InstrumentedMutexLock l(mutex_); - *desc = ColumnFamilyDescriptor( - cfd()->GetName(), - BuildColumnFamilyOptions(*cfd()->options(), - *cfd()->GetLatestMutableCFOptions())); + *desc = ColumnFamilyDescriptor(cfd()->GetName(), cfd()->GetLatestCFOptions()); return Status::OK(); #else return Status::NotSupported(); diff --git a/db/column_family.h b/db/column_family.h index 1f3642c11..7d1348989 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -201,9 +201,6 @@ class ColumnFamilyData { void SetLogNumber(uint64_t log_number) { log_number_ = log_number; } uint64_t GetLogNumber() const { return log_number_; } - // !!! To be deprecated! Please don't not use this function anymore! - const Options* options() const { return &options_; } - // thread-safe const EnvOptions* soptions() const; const ImmutableCFOptions* ioptions() const { return &ioptions_; } diff --git a/db/compaction_job.cc b/db/compaction_job.cc index 32907c077..82dd6d83f 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -297,7 +297,7 @@ CompactionJob::CompactionJob( assert(log_buffer_ != nullptr); const auto* cfd = compact_->compaction->column_family_data(); ThreadStatusUtil::SetColumnFamily(cfd, cfd->ioptions()->env, - cfd->options()->enable_thread_tracking); + db_options_.enable_thread_tracking); ThreadStatusUtil::SetThreadOperation(ThreadStatus::OP_COMPACTION); ReportStartedCompaction(compaction); } @@ -311,7 +311,7 @@ void CompactionJob::ReportStartedCompaction( Compaction* compaction) { const auto* cfd = compact_->compaction->column_family_data(); ThreadStatusUtil::SetColumnFamily(cfd, cfd->ioptions()->env, - cfd->options()->enable_thread_tracking); + db_options_.enable_thread_tracking); ThreadStatusUtil::SetThreadOperationProperty( ThreadStatus::COMPACTION_JOB_ID, diff --git a/db/db_impl.cc b/db/db_impl.cc index 7e101fb7c..cefa98913 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3441,9 +3441,9 @@ Status DBImpl::BackgroundCompaction(bool* made_progress, TEST_SYNC_POINT("DBImpl::BackgroundCompaction:TrivialMove"); // Instrument for event update // TODO(yhchiang): add op details for showing trivial-move. - ThreadStatusUtil::SetColumnFamily( - c->column_family_data(), c->column_family_data()->ioptions()->env, - c->column_family_data()->options()->enable_thread_tracking); + ThreadStatusUtil::SetColumnFamily(c->column_family_data(), + c->column_family_data()->ioptions()->env, + db_options_.enable_thread_tracking); ThreadStatusUtil::SetThreadOperation(ThreadStatus::OP_COMPACTION); compaction_job_stats.num_input_files = c->num_input_files(0); diff --git a/db/flush_job.cc b/db/flush_job.cc index bb38f485d..521e013b9 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -97,7 +97,7 @@ FlushJob::~FlushJob() { void FlushJob::ReportStartedFlush() { ThreadStatusUtil::SetColumnFamily(cfd_, cfd_->ioptions()->env, - cfd_->options()->enable_thread_tracking); + db_options_.enable_thread_tracking); ThreadStatusUtil::SetThreadOperation(ThreadStatus::OP_FLUSH); ThreadStatusUtil::SetThreadOperationProperty( ThreadStatus::COMPACTION_JOB_ID,