DeleteFilesInRange: Clean job context if no files deleted

Summary:
We need to clean the job context if we end up not deleting any
files because no files are in the range specified.

Test Plan: DBCompactionTest.DeleteFileRange

Reviewers: sdong, anthony, yhchiang, kradhakrishnan, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D52467
main
Venkatesh Radhakrishnan 9 years ago
parent 1dec5b8f5d
commit d74c9f0a57
  1. 7
      db/db_compaction_test.cc
  2. 1
      db/db_impl.cc

@ -1230,6 +1230,13 @@ TEST_F(DBCompactionTest, DeleteFileRange) {
}
}
ASSERT_GT(deleted_count, 0);
begin_string = Key(5000);
end_string = Key(6000);
Slice begin1(begin_string);
Slice end1(end_string);
// Try deleting files in range which contain no keys
ASSERT_OK(
DeleteFilesInRange(db_, db_->DefaultColumnFamily(), &begin1, &end1));
ASSERT_OK(
DeleteFilesInRange(db_, db_->DefaultColumnFamily(), nullptr, nullptr));

@ -5056,6 +5056,7 @@ Status DBImpl::DeleteFilesInRange(ColumnFamilyHandle* column_family,
}
}
if (edit.GetDeletedFiles().empty()) {
job_context.Clean();
return Status::OK();
}
status = versions_->LogAndApply(cfd, *cfd->GetLatestMutableCFOptions(),

Loading…
Cancel
Save