]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore, kv/rocksdb: Cleanup on close_db_environment
authorAdam Kupczyk <akupczyk@redhat.com>
Thu, 28 Jul 2022 13:25:14 +0000 (13:25 +0000)
committerIgor Fedotov <igor.fedotov@croit.io>
Mon, 3 Oct 2022 13:09:51 +0000 (16:09 +0300)
Refine actions taken in close_db_environment. Its role is to close
db handle and environment when db was used in special modes - repair/reshard,
and is not actually open to typical r/w.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 964ce8682c15007573b9d2a1d90fc90048f59411..39ffa942f338205af14abd75af7b85fc6283a501 100644 (file)
@@ -6524,6 +6524,11 @@ void BlueStore::_close_db_and_around()
   if (db) {
     _close_db();
   }
+  _close_around_db();
+}
+
+void BlueStore::_close_around_db()
+{
   if (bluefs) {
     _close_bluefs();
   }
@@ -6548,7 +6553,11 @@ int BlueStore::open_db_environment(KeyValueDB **pdb, bool to_repair)
 
 int BlueStore::close_db_environment()
 {
-  _close_db_and_around();
+  if (db) {
+    delete db;
+    db = nullptr;
+  }
+  _close_around_db();
   return 0;
 }
 
index 4c21846ed174bf5452d6974d96f22d2d47f7f386..e3ede24fbd5a0723948f99bdebdeb4456e397eef 100644 (file)
@@ -2649,6 +2649,7 @@ private:
   */
   int _open_db_and_around(bool read_only, bool to_repair = false);
   void _close_db_and_around();
+  void _close_around_db();
 
   int _prepare_db_environment(bool create, bool read_only,
                              std::string* kv_dir, std::string* kv_backend);