From eec86952062cf1e298647823707111a23e9ca4b5 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Thu, 6 Mar 2014 18:15:26 -0800 Subject: [PATCH] Delete local sv when destroying DB from stress test Summary: Not deleting local SV caused some an crash test issue: http://ci-builds.fb.com/job/rocksdb_asan_crash_test/83/console Test Plan: ran unit tests Reviewers: ljin Reviewed By: ljin CC: leveldb Differential Revision: https://reviews.facebook.net/D16635 --- db/db_impl.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index d05424410..b8942c42a 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -402,6 +402,15 @@ void DBImpl::TEST_Destroy_DBImpl() { bg_logstats_scheduled_) { bg_cv_.Wait(); } + mutex_.Unlock(); + + // Release SuperVersion reference kept in ThreadLocalPtr. + // This must be done outside of mutex_ since unref handler can lock mutex. + // It also needs to be done after FlushMemTable, which can trigger local_sv_ + // access. + delete local_sv_; + + mutex_.Lock(); if (super_version_ != nullptr) { bool is_last_reference __attribute__((unused)); is_last_reference = super_version_->Unref();