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
main
Yi Wu 7 years ago committed by Facebook Github Bot
parent edc258127e
commit d46e832e94
  1. 6
      db/column_family.cc

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

Loading…
Cancel
Save