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
This commit is contained in:
Igor Canadi 2014-01-29 11:50:49 -08:00
parent 20b231d712
commit 4662969bf5

View File

@ -2994,7 +2994,7 @@ Status DBImpl::DropColumnFamily(const ColumnFamilyHandle& column_family) {
if (column_family.id == 0) { if (column_family.id == 0) {
return Status::InvalidArgument("Can't drop default column family"); return Status::InvalidArgument("Can't drop default column family");
} }
MutexLock l(&mutex_); mutex_.Lock();
if (!versions_->GetColumnFamilySet()->Exists(column_family.id)) { if (!versions_->GetColumnFamilySet()->Exists(column_family.id)) {
return Status::NotFound("Column family not found"); return Status::NotFound("Column family not found");
} }
@ -3006,7 +3006,10 @@ Status DBImpl::DropColumnFamily(const ColumnFamilyHandle& column_family) {
// remove from internal data structures // remove from internal data structures
versions_->DropColumnFamily(&edit); 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", Log(options_.info_log, "Dropped column family with id %u\n",
column_family.id); column_family.id);
return s; return s;