Cleanup cf handlers before deleting db (#8564)

Summary:
Delete column family handlers before deleting db to avoid `last_ref`
assert.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8564

Test Plan: Inject compaction test in db_stress test

Reviewed By: pdillinger

Differential Revision: D29797375

Pulled By: jay-zhuang

fbshipit-source-id: e8baf4d279f4db5d963db95c9445454156205501
This commit is contained in:
Jay Zhuang 2021-07-20 14:58:19 -07:00 committed by Facebook GitHub Bot
parent bbc85a5f22
commit 66ca5ac427

View file

@ -2563,7 +2563,12 @@ void StressTest::Open() {
s = static_cast_with_check<DBImpl>(db_->GetRootDB())
->TEST_WaitForCompact(true);
if (!s.ok()) {
for (auto cf : column_families_) {
delete cf;
}
column_families_.clear();
delete db_;
db_ = nullptr;
}
}
if (!s.ok()) {