From 7dfbe33532dc311421cef28bf00d979d55453338 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Fri, 27 Apr 2018 11:11:12 -0700 Subject: [PATCH] Rename pending_compaction_ to queued_for_compaction_. Summary: We use `queued_for_flush_` to indicate a column family has been added to the flush queue. Similarly and to be consistent in our naming, we need to use `queued_for_compaction_` to indicate a column family has been added to the compaction queue. In the past we used `pending_compaction_` which can also be ambiguous. Closes https://github.com/facebook/rocksdb/pull/3781 Differential Revision: D7790063 Pulled By: riversand963 fbshipit-source-id: 6786b11a4fcaea36dc9b4672233dbe042f921804 --- db/column_family.cc | 4 ++-- db/column_family.h | 6 +++--- db/db_impl_compaction_flush.cc | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/db/column_family.cc b/db/column_family.cc index 4164e5f8aa..d35d6fbfc0 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -428,7 +428,7 @@ ColumnFamilyData::ColumnFamilyData( flush_reason_(FlushReason::kOthers), column_family_set_(column_family_set), queued_for_flush_(false), - pending_compaction_(false), + queued_for_compaction_(false), prev_compaction_needed_bytes_(0), allow_2pc_(db_options.allow_2pc), last_memtable_id_(0) { @@ -505,7 +505,7 @@ ColumnFamilyData::~ColumnFamilyData() { // It would be wrong if this ColumnFamilyData is in flush_queue_ or // compaction_queue_ and we destroyed it assert(!queued_for_flush_); - assert(!pending_compaction_); + assert(!queued_for_compaction_); if (super_version_ != nullptr) { // Release SuperVersion reference kept in ThreadLocalPtr. diff --git a/db/column_family.h b/db/column_family.h index 48b872d379..d7fb5db743 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -346,9 +346,9 @@ class ColumnFamilyData { // Protected by DB mutex void set_queued_for_flush(bool value) { queued_for_flush_ = value; } - void set_pending_compaction(bool value) { pending_compaction_ = value; } + void set_queued_for_compaction(bool value) { queued_for_compaction_ = value; } bool queued_for_flush() { return queued_for_flush_; } - bool pending_compaction() { return pending_compaction_; } + bool queued_for_compaction() { return queued_for_compaction_; } enum class WriteStallCause { kNone, @@ -457,7 +457,7 @@ class ColumnFamilyData { // If true --> this ColumnFamily is currently present in // DBImpl::compaction_queue_ - bool pending_compaction_; + bool queued_for_compaction_; uint64_t prev_compaction_needed_bytes_; diff --git a/db/db_impl_compaction_flush.cc b/db/db_impl_compaction_flush.cc index 2a43bc8184..7c15e2e2cd 100644 --- a/db/db_impl_compaction_flush.cc +++ b/db/db_impl_compaction_flush.cc @@ -1272,18 +1272,18 @@ DBImpl::BGJobLimits DBImpl::GetBGJobLimits(int max_background_flushes, } void DBImpl::AddToCompactionQueue(ColumnFamilyData* cfd) { - assert(!cfd->pending_compaction()); + assert(!cfd->queued_for_compaction()); cfd->Ref(); compaction_queue_.push_back(cfd); - cfd->set_pending_compaction(true); + cfd->set_queued_for_compaction(true); } ColumnFamilyData* DBImpl::PopFirstFromCompactionQueue() { assert(!compaction_queue_.empty()); auto cfd = *compaction_queue_.begin(); compaction_queue_.pop_front(); - assert(cfd->pending_compaction()); - cfd->set_pending_compaction(false); + assert(cfd->queued_for_compaction()); + cfd->set_queued_for_compaction(false); return cfd; } @@ -1314,7 +1314,7 @@ void DBImpl::SchedulePendingFlush(ColumnFamilyData* cfd, } void DBImpl::SchedulePendingCompaction(ColumnFamilyData* cfd) { - if (!cfd->pending_compaction() && cfd->NeedsCompaction()) { + if (!cfd->queued_for_compaction() && cfd->NeedsCompaction()) { AddToCompactionQueue(cfd); ++unscheduled_compactions_; }