From: Adam Kupczyk Date: Thu, 28 Jul 2022 13:25:14 +0000 (+0000) Subject: os/bluestore, kv/rocksdb: Cleanup on close_db_environment X-Git-Tag: v18.1.0~896^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e78504a06ab92110f99959e6ca2eaeb624e5cfcf;p=ceph.git os/bluestore, kv/rocksdb: Cleanup on close_db_environment 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 964ce8682c150..39ffa942f3382 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 4c21846ed174b..e3ede24fbd5a0 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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);