From 1e4a45aac88533fd9aefac643f0360a44afe6c61 Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Tue, 18 Nov 2014 10:19:48 -0800 Subject: [PATCH] remove cfd->options() in DBImpl::NotifyOnFlushCompleted Summary: We should not reference cfd->options() directly! Test Plan: make release Reviewers: sdong, rven, igor, yhchiang Reviewed By: igor, yhchiang Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D29061 --- db/column_family.h | 1 + db/db_impl.cc | 9 +++++---- db/db_impl.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/db/column_family.h b/db/column_family.h index b421e44c6..f24105fbe 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -173,6 +173,7 @@ class ColumnFamilyData { uint64_t GetLogNumber() const { return log_number_; } // thread-safe + // To be deprecated! Please don't not use this function anymore! const Options* options() const { return &options_; } const EnvOptions* soptions() const; const ImmutableCFOptions* ioptions() const { return &ioptions_; } diff --git a/db/db_impl.cc b/db/db_impl.cc index fb851b3d4..587ca2068 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1095,24 +1095,25 @@ Status DBImpl::FlushMemTableToOutputFile( #ifndef ROCKSDB_LITE if (s.ok()) { // may temporarily unlock and lock the mutex. - NotifyOnFlushCompleted(cfd, file_number); + NotifyOnFlushCompleted(cfd, file_number, mutable_cf_options); } #endif // ROCKSDB_LITE return s; } void DBImpl::NotifyOnFlushCompleted( - ColumnFamilyData* cfd, uint64_t file_number) { + ColumnFamilyData* cfd, uint64_t file_number, + const MutableCFOptions& mutable_cf_options) { mutex_.AssertHeld(); if (shutting_down_.load(std::memory_order_acquire)) { return; } bool triggered_flush_slowdown = (cfd->current()->storage_info()->NumLevelFiles(0) >= - cfd->options()->level0_slowdown_writes_trigger); + mutable_cf_options.level0_slowdown_writes_trigger); bool triggered_flush_stop = (cfd->current()->storage_info()->NumLevelFiles(0) >= - cfd->options()->level0_stop_writes_trigger); + mutable_cf_options.level0_stop_writes_trigger); notifying_events_++; // release lock while notifying events mutex_.Unlock(); diff --git a/db/db_impl.h b/db/db_impl.h index c3c7c72a1..cce238284 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -261,7 +261,8 @@ class DBImpl : public DB { Iterator* NewInternalIterator(const ReadOptions&, ColumnFamilyData* cfd, SuperVersion* super_version, Arena* arena); - void NotifyOnFlushCompleted(ColumnFamilyData* cfd, uint64_t file_number); + void NotifyOnFlushCompleted(ColumnFamilyData* cfd, uint64_t file_number, + const MutableCFOptions& mutable_cf_options); private: friend class DB;