Assert last reference before destroy ColumnFamilyData

Summary:
In ColumnFamilySet destructor, assert it hold the last reference to cfd before destroy them.

Closes #3112
Closes https://github.com/facebook/rocksdb/pull/3397

Differential Revision: D6777967

Pulled By: yiwu-arbug

fbshipit-source-id: 60b19070e0c194b3b6146699140c1d68777866cb
This commit is contained in:
Yi Wu 2018-01-23 15:08:29 -08:00 committed by Facebook Github Bot
parent edc258127e
commit d46e832e94

View File

@ -1060,10 +1060,12 @@ ColumnFamilySet::~ColumnFamilySet() {
while (column_family_data_.size() > 0) {
// cfd destructor will delete itself from column_family_data_
auto cfd = column_family_data_.begin()->second;
cfd->Unref();
bool last_ref __attribute__((__unused__)) = cfd->Unref();
assert(last_ref);
delete cfd;
}
dummy_cfd_->Unref();
bool dummy_last_ref __attribute__((__unused__)) = dummy_cfd_->Unref();
assert(dummy_last_ref);
delete dummy_cfd_;
}