From 00395f8f1f774a0827e1c10d49eebc55e23ee039 Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Fri, 8 Mar 2019 11:31:32 +1000 Subject: [PATCH] src/tools/kvstore_tool.cc: Move bluestore start-up code Move this code into a separate function to avoid ICE. Fixes: http://tracker.ceph.com/issues/38633 Signed-off-by: Brad Hubbard --- src/tools/kvstore_tool.cc | 18 +++++++++++++----- src/tools/kvstore_tool.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/tools/kvstore_tool.cc b/src/tools/kvstore_tool.cc index 2d94e610c731..7ed6c9e2d09e 100644 --- a/src/tools/kvstore_tool.cc +++ b/src/tools/kvstore_tool.cc @@ -15,12 +15,8 @@ StoreTool::StoreTool(const string& type, const string& path, bool need_open_db) { if (type == "bluestore-kv") { #ifdef WITH_BLUESTORE - auto bluestore = new BlueStore(g_ceph_context, path); - KeyValueDB *db_ptr; - if (int r = bluestore->start_kv_only(&db_ptr, need_open_db); r < 0) { + if (load_bluestore(path, need_open_db) != 0) exit(1); - } - db = decltype(db){db_ptr, Deleter(bluestore)}; #else cerr << "bluestore not compiled in" << std::endl; exit(1); @@ -38,6 +34,18 @@ StoreTool::StoreTool(const string& type, const string& path, bool need_open_db) } } +int StoreTool::load_bluestore(const string& path, bool need_open_db) +{ + auto bluestore = new BlueStore(g_ceph_context, path); + KeyValueDB *db_ptr; + int r = bluestore->start_kv_only(&db_ptr, need_open_db); + if (r < 0) { + return -EINVAL; + } + db = decltype(db){db_ptr, Deleter(bluestore)}; + return 0; +} + uint32_t StoreTool::traverse(const string& prefix, const bool do_crc, const bool do_value_dump, diff --git a/src/tools/kvstore_tool.h b/src/tools/kvstore_tool.h index 296ee5d9a79e..3203024728e9 100644 --- a/src/tools/kvstore_tool.h +++ b/src/tools/kvstore_tool.h @@ -44,6 +44,7 @@ public: StoreTool(const std::string& type, const std::string& path, bool need_open_db=true); + int load_bluestore(const std::string& path, bool need_open_db); uint32_t traverse(const std::string& prefix, const bool do_crc, const bool do_value_dump, -- 2.47.3