Fix ColumnFamilyTest:BulkAddDrop

Summary:
Fix ColumnFamilyTest:BulkAddDrop not deleted CF handles at the end, causing ASAN failure.
Closes https://github.com/facebook/rocksdb/pull/2275

Differential Revision: D5040724

Pulled By: yiwu-arbug

fbshipit-source-id: 86cd4070c944d01173a3cc36462bb800698af192
This commit is contained in:
Yi Wu 2017-05-10 22:46:24 -07:00 committed by Facebook Github Bot
parent cda5fde2d9
commit 3907c94ffb

View File

@ -692,6 +692,9 @@ TEST_F(ColumnFamilyTest, BulkAddDrop) {
} }
ASSERT_OK(db_->DropColumnFamilies(cf_handles)); ASSERT_OK(db_->DropColumnFamilies(cf_handles));
std::vector<ColumnFamilyDescriptor> cf_descriptors; std::vector<ColumnFamilyDescriptor> cf_descriptors;
for (auto* handle : cf_handles) {
delete handle;
}
cf_handles.clear(); cf_handles.clear();
for (int i = 1; i <= kNumCF; i++) { for (int i = 1; i <= kNumCF; i++) {
cf_descriptors.emplace_back("cf2-" + ToString(i), ColumnFamilyOptions()); cf_descriptors.emplace_back("cf2-" + ToString(i), ColumnFamilyOptions());
@ -701,6 +704,9 @@ TEST_F(ColumnFamilyTest, BulkAddDrop) {
ASSERT_OK(db_->Put(write_options, cf_handles[i - 1], "foo", "bar")); ASSERT_OK(db_->Put(write_options, cf_handles[i - 1], "foo", "bar"));
} }
ASSERT_OK(db_->DropColumnFamilies(cf_handles)); ASSERT_OK(db_->DropColumnFamilies(cf_handles));
for (auto* handle : cf_handles) {
delete handle;
}
Close(); Close();
std::vector<std::string> families; std::vector<std::string> families;
ASSERT_OK(DB::ListColumnFamilies(db_options_, dbname_, &families)); ASSERT_OK(DB::ListColumnFamilies(db_options_, dbname_, &families));