#ifdef HAVE_KINETIC
#include "KineticStore.h"
#endif
-#ifdef HAVE_LIBAIO
-#include "os/bluestore/BlueStore.h"
-#endif
KeyValueDB *KeyValueDB::create(CephContext *cct, const string& type,
const string& dir,
}
#endif
-#ifdef HAVE_LIBAIO
- if (type == "bluestore-kv") {
- // note: we'll leak this! the only user is ceph-kvstore-tool and
- // we don't care.
- BlueStore *bluestore = new BlueStore(cct, dir);
- KeyValueDB *db = nullptr;
- int r = bluestore->start_kv_only(&db);
- if (r < 0)
- return nullptr; // yes, we leak.
- return db;
- }
-#endif
if ((type == "memdb") &&
cct->check_experimental_feature_enabled("memdb")) {
return new MemDB(cct, dir, p);
return ret;
}
-int BlueStore::_open_db(bool create, bool kv_no_open)
+int BlueStore::_open_db(bool create)
{
int r;
assert(!db);
if (kv_backend == "rocksdb")
options = cct->_conf->bluestore_rocksdb_options;
db->init(options);
- if (kv_no_open) {
- return 0;
- }
if (create)
r = db->create_and_open(err);
else
if (r < 0)
goto out_fsid;
- r = _open_db(false, kv_only);
+ r = _open_db(false);
if (r < 0)
goto out_bdev;
int _open_bdev(bool create);
void _close_bdev();
- int _open_db(bool create, bool kv_no_open=false);
+ int _open_db(bool create);
void _close_db();
int _open_fm(bool create);
void _close_fm();
#include "kv/KeyValueDB.h"
#include "common/url_escape.h"
+#ifdef HAVE_LIBAIO
+#include "os/bluestore/BlueStore.h"
+#endif
+
using namespace std;
class StoreTool
public:
StoreTool(string type, const string &path) : store_path(path) {
- KeyValueDB *db_ptr = KeyValueDB::create(g_ceph_context, type, path);
- int r = db_ptr->open(std::cerr);
- if (r < 0) {
- cerr << "failed to open type " << type << " path " << path << ": "
- << cpp_strerror(r) << std::endl;
+ KeyValueDB *db_ptr;
+ if (type == "bluestore-kv") {
+#ifdef HAVE_LIBAIO
+ // note: we'll leak this! the only user is ceph-kvstore-tool and
+ // we don't care.
+ BlueStore *bluestore = new BlueStore(g_ceph_context, path);
+ int r = bluestore->start_kv_only(&db_ptr);
+ if (r < 0) {
+ exit(1);
+ }
+#else
+ cerr << "bluestore not compiled in" << std::endl;
exit(1);
+#endif
+ } else {
+ db_ptr = KeyValueDB::create(g_ceph_context, type, path);
+ int r = db_ptr->open(std::cerr);
+ if (r < 0) {
+ cerr << "failed to open type " << type << " path " << path << ": "
+ << cpp_strerror(r) << std::endl;
+ exit(1);
+ }
}
db.reset(db_ptr);
}