mirror of https://github.com/facebook/rocksdb.git
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
This commit is contained in:
parent
513b5ce618
commit
7dfbe33532
|
@ -428,7 +428,7 @@ ColumnFamilyData::ColumnFamilyData(
|
||||||
flush_reason_(FlushReason::kOthers),
|
flush_reason_(FlushReason::kOthers),
|
||||||
column_family_set_(column_family_set),
|
column_family_set_(column_family_set),
|
||||||
queued_for_flush_(false),
|
queued_for_flush_(false),
|
||||||
pending_compaction_(false),
|
queued_for_compaction_(false),
|
||||||
prev_compaction_needed_bytes_(0),
|
prev_compaction_needed_bytes_(0),
|
||||||
allow_2pc_(db_options.allow_2pc),
|
allow_2pc_(db_options.allow_2pc),
|
||||||
last_memtable_id_(0) {
|
last_memtable_id_(0) {
|
||||||
|
@ -505,7 +505,7 @@ ColumnFamilyData::~ColumnFamilyData() {
|
||||||
// It would be wrong if this ColumnFamilyData is in flush_queue_ or
|
// It would be wrong if this ColumnFamilyData is in flush_queue_ or
|
||||||
// compaction_queue_ and we destroyed it
|
// compaction_queue_ and we destroyed it
|
||||||
assert(!queued_for_flush_);
|
assert(!queued_for_flush_);
|
||||||
assert(!pending_compaction_);
|
assert(!queued_for_compaction_);
|
||||||
|
|
||||||
if (super_version_ != nullptr) {
|
if (super_version_ != nullptr) {
|
||||||
// Release SuperVersion reference kept in ThreadLocalPtr.
|
// Release SuperVersion reference kept in ThreadLocalPtr.
|
||||||
|
|
|
@ -346,9 +346,9 @@ class ColumnFamilyData {
|
||||||
|
|
||||||
// Protected by DB mutex
|
// Protected by DB mutex
|
||||||
void set_queued_for_flush(bool value) { queued_for_flush_ = value; }
|
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 queued_for_flush() { return queued_for_flush_; }
|
||||||
bool pending_compaction() { return pending_compaction_; }
|
bool queued_for_compaction() { return queued_for_compaction_; }
|
||||||
|
|
||||||
enum class WriteStallCause {
|
enum class WriteStallCause {
|
||||||
kNone,
|
kNone,
|
||||||
|
@ -457,7 +457,7 @@ class ColumnFamilyData {
|
||||||
|
|
||||||
// If true --> this ColumnFamily is currently present in
|
// If true --> this ColumnFamily is currently present in
|
||||||
// DBImpl::compaction_queue_
|
// DBImpl::compaction_queue_
|
||||||
bool pending_compaction_;
|
bool queued_for_compaction_;
|
||||||
|
|
||||||
uint64_t prev_compaction_needed_bytes_;
|
uint64_t prev_compaction_needed_bytes_;
|
||||||
|
|
||||||
|
|
|
@ -1272,18 +1272,18 @@ DBImpl::BGJobLimits DBImpl::GetBGJobLimits(int max_background_flushes,
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBImpl::AddToCompactionQueue(ColumnFamilyData* cfd) {
|
void DBImpl::AddToCompactionQueue(ColumnFamilyData* cfd) {
|
||||||
assert(!cfd->pending_compaction());
|
assert(!cfd->queued_for_compaction());
|
||||||
cfd->Ref();
|
cfd->Ref();
|
||||||
compaction_queue_.push_back(cfd);
|
compaction_queue_.push_back(cfd);
|
||||||
cfd->set_pending_compaction(true);
|
cfd->set_queued_for_compaction(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnFamilyData* DBImpl::PopFirstFromCompactionQueue() {
|
ColumnFamilyData* DBImpl::PopFirstFromCompactionQueue() {
|
||||||
assert(!compaction_queue_.empty());
|
assert(!compaction_queue_.empty());
|
||||||
auto cfd = *compaction_queue_.begin();
|
auto cfd = *compaction_queue_.begin();
|
||||||
compaction_queue_.pop_front();
|
compaction_queue_.pop_front();
|
||||||
assert(cfd->pending_compaction());
|
assert(cfd->queued_for_compaction());
|
||||||
cfd->set_pending_compaction(false);
|
cfd->set_queued_for_compaction(false);
|
||||||
return cfd;
|
return cfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1314,7 +1314,7 @@ void DBImpl::SchedulePendingFlush(ColumnFamilyData* cfd,
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBImpl::SchedulePendingCompaction(ColumnFamilyData* cfd) {
|
void DBImpl::SchedulePendingCompaction(ColumnFamilyData* cfd) {
|
||||||
if (!cfd->pending_compaction() && cfd->NeedsCompaction()) {
|
if (!cfd->queued_for_compaction() && cfd->NeedsCompaction()) {
|
||||||
AddToCompactionQueue(cfd);
|
AddToCompactionQueue(cfd);
|
||||||
++unscheduled_compactions_;
|
++unscheduled_compactions_;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue