Remove Compaction::ReleaseInputs().

Summary:
This patch remove the unnecessary Compaction::ReleaseInputs().

Compaction::ReleaseInputs() tries to unref its input_version
and column_family.  However, such unref is always done in
~Compaction(), and all current ReleaseInputs() calls are
right before the destructor.

Test Plan: ./db_test

Reviewers: igor

Reviewed By: igor

Subscribers: igor, rven, dhruba, sdong

Differential Revision: https://reviews.facebook.net/D31605
main
Yueh-Hsuan Chiang 10 years ago
parent f2ddb8b452
commit b229f970df
  1. 13
      db/compaction.cc
  2. 4
      db/compaction.h
  3. 3
      db/db_impl.cc

@ -242,19 +242,6 @@ void Compaction::SetupBottomMostLevel(VersionStorageInfo* vstorage,
} }
} }
void Compaction::ReleaseInputs() {
if (input_version_ != nullptr) {
input_version_->Unref();
input_version_ = nullptr;
}
if (cfd_ != nullptr) {
if (cfd_->Unref()) {
delete cfd_;
}
cfd_ = nullptr;
}
}
void Compaction::ReleaseCompactionFiles(Status status) { void Compaction::ReleaseCompactionFiles(Status status) {
cfd_->compaction_picker()->ReleaseCompactionFiles(this, status); cfd_->compaction_picker()->ReleaseCompactionFiles(this, status);
} }

@ -135,10 +135,6 @@ class Compaction {
// before processing "internal_key". // before processing "internal_key".
bool ShouldStopBefore(const Slice& internal_key); bool ShouldStopBefore(const Slice& internal_key);
// Release the input version for the compaction, once the compaction
// is successful.
void ReleaseInputs();
// Clear all files to indicate that they are not being compacted // Clear all files to indicate that they are not being compacted
// Delete this compaction from the list of running compactions. // Delete this compaction from the list of running compactions.
void ReleaseCompactionFiles(Status status); void ReleaseCompactionFiles(Status status);

@ -1344,7 +1344,6 @@ Status DBImpl::CompactFilesImpl(
*c->mutable_cf_options()); *c->mutable_cf_options());
} }
c->ReleaseCompactionFiles(s); c->ReleaseCompactionFiles(s);
c->ReleaseInputs();
c.reset(); c.reset();
if (status.ok()) { if (status.ok()) {
@ -2203,9 +2202,9 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context,
*c->mutable_cf_options()); *c->mutable_cf_options());
} }
c->ReleaseCompactionFiles(status); c->ReleaseCompactionFiles(status);
c->ReleaseInputs();
*madeProgress = true; *madeProgress = true;
} }
// this will unref its input_version and column_family_data
c.reset(); c.reset();
if (status.ok()) { if (status.ok()) {

Loading…
Cancel
Save