From 4662969bf5d4397db831a89c2d179884bf04fd71 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 29 Jan 2014 11:50:49 -0800 Subject: [PATCH] PurgeObsoleteFiles in DropColumnFamily Summary: When we drop the column family, we want to delete all the files from that column family. Test Plan: make check Reviewers: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D15561 --- db/db_impl.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index f8f52a9b6..3cc14102c 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -2994,7 +2994,7 @@ Status DBImpl::DropColumnFamily(const ColumnFamilyHandle& column_family) { if (column_family.id == 0) { return Status::InvalidArgument("Can't drop default column family"); } - MutexLock l(&mutex_); + mutex_.Lock(); if (!versions_->GetColumnFamilySet()->Exists(column_family.id)) { return Status::NotFound("Column family not found"); } @@ -3006,7 +3006,10 @@ Status DBImpl::DropColumnFamily(const ColumnFamilyHandle& column_family) { // remove from internal data structures versions_->DropColumnFamily(&edit); } - // TODO(icanadi) PurgeObsoletetFiles here + DeletionState deletion_state; + FindObsoleteFiles(deletion_state, false, true); + mutex_.Unlock(); + PurgeObsoleteFiles(deletion_state); Log(options_.info_log, "Dropped column family with id %u\n", column_family.id); return s;