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
main
Lei Jin 10 years ago
parent 517c28994d
commit 1e4a45aac8
  1. 1
      db/column_family.h
  2. 9
      db/db_impl.cc
  3. 3
      db/db_impl.h

@ -173,6 +173,7 @@ class ColumnFamilyData {
uint64_t GetLogNumber() const { return log_number_; } uint64_t GetLogNumber() const { return log_number_; }
// thread-safe // thread-safe
// To be deprecated! Please don't not use this function anymore!
const Options* options() const { return &options_; } const Options* options() const { return &options_; }
const EnvOptions* soptions() const; const EnvOptions* soptions() const;
const ImmutableCFOptions* ioptions() const { return &ioptions_; } const ImmutableCFOptions* ioptions() const { return &ioptions_; }

@ -1095,24 +1095,25 @@ Status DBImpl::FlushMemTableToOutputFile(
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
if (s.ok()) { if (s.ok()) {
// may temporarily unlock and lock the mutex. // may temporarily unlock and lock the mutex.
NotifyOnFlushCompleted(cfd, file_number); NotifyOnFlushCompleted(cfd, file_number, mutable_cf_options);
} }
#endif // ROCKSDB_LITE #endif // ROCKSDB_LITE
return s; return s;
} }
void DBImpl::NotifyOnFlushCompleted( void DBImpl::NotifyOnFlushCompleted(
ColumnFamilyData* cfd, uint64_t file_number) { ColumnFamilyData* cfd, uint64_t file_number,
const MutableCFOptions& mutable_cf_options) {
mutex_.AssertHeld(); mutex_.AssertHeld();
if (shutting_down_.load(std::memory_order_acquire)) { if (shutting_down_.load(std::memory_order_acquire)) {
return; return;
} }
bool triggered_flush_slowdown = bool triggered_flush_slowdown =
(cfd->current()->storage_info()->NumLevelFiles(0) >= (cfd->current()->storage_info()->NumLevelFiles(0) >=
cfd->options()->level0_slowdown_writes_trigger); mutable_cf_options.level0_slowdown_writes_trigger);
bool triggered_flush_stop = bool triggered_flush_stop =
(cfd->current()->storage_info()->NumLevelFiles(0) >= (cfd->current()->storage_info()->NumLevelFiles(0) >=
cfd->options()->level0_stop_writes_trigger); mutable_cf_options.level0_stop_writes_trigger);
notifying_events_++; notifying_events_++;
// release lock while notifying events // release lock while notifying events
mutex_.Unlock(); mutex_.Unlock();

@ -261,7 +261,8 @@ class DBImpl : public DB {
Iterator* NewInternalIterator(const ReadOptions&, ColumnFamilyData* cfd, Iterator* NewInternalIterator(const ReadOptions&, ColumnFamilyData* cfd,
SuperVersion* super_version, Arena* arena); 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: private:
friend class DB; friend class DB;

Loading…
Cancel
Save