From b229f970dfd2c62450dcc089e4fecee0d8cb249f Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Thu, 15 Jan 2015 12:44:19 -0800 Subject: [PATCH] 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 --- db/compaction.cc | 13 ------------- db/compaction.h | 4 ---- db/db_impl.cc | 3 +-- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/db/compaction.cc b/db/compaction.cc index 0d85ce486..56be34ef3 100644 --- a/db/compaction.cc +++ b/db/compaction.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) { cfd_->compaction_picker()->ReleaseCompactionFiles(this, status); } diff --git a/db/compaction.h b/db/compaction.h index 99f35abb9..37e38532b 100644 --- a/db/compaction.h +++ b/db/compaction.h @@ -135,10 +135,6 @@ class Compaction { // before processing "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 // Delete this compaction from the list of running compactions. void ReleaseCompactionFiles(Status status); diff --git a/db/db_impl.cc b/db/db_impl.cc index f5d6d99f0..fa1c87aee 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1344,7 +1344,6 @@ Status DBImpl::CompactFilesImpl( *c->mutable_cf_options()); } c->ReleaseCompactionFiles(s); - c->ReleaseInputs(); c.reset(); if (status.ok()) { @@ -2203,9 +2202,9 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context, *c->mutable_cf_options()); } c->ReleaseCompactionFiles(status); - c->ReleaseInputs(); *madeProgress = true; } + // this will unref its input_version and column_family_data c.reset(); if (status.ok()) {