To ensure LevelDBStore::db is destroyed before dependent LevelDBStore::db_cache and LevelDBStore::filterpolicy.

Signed-off-by: Signed-off-by: Ray Lv <xiangyulv@gmail.com>
This commit is contained in:
Ray Lv 2014-01-17 20:42:54 +08:00
parent f8fa30953e
commit f01202de89
2 changed files with 4 additions and 1 deletions

View File

@ -75,6 +75,9 @@ LevelDBStore::~LevelDBStore()
{
close();
delete logger;
// Ensure db is destroyed before dependent db_cache and filterpolicy
db.reset();
}
void LevelDBStore::close()

View File

@ -48,11 +48,11 @@ class LevelDBStore : public KeyValueDB {
CephContext *cct;
PerfCounters *logger;
string path;
boost::scoped_ptr<leveldb::DB> db;
boost::scoped_ptr<leveldb::Cache> db_cache;
#ifdef HAVE_LEVELDB_FILTER_POLICY
boost::scoped_ptr<const leveldb::FilterPolicy> filterpolicy;
#endif
boost::scoped_ptr<leveldb::DB> db;
int init(ostream &out, bool create_if_missing);