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
main
Igor Canadi 11 years ago
parent 20b231d712
commit 4662969bf5
  1. 7
      db/db_impl.cc

@ -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;

Loading…
Cancel
Save