]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonitorDBStore: use generic KeyValueDB::create()
authorSage Weil <sage@inktank.com>
Tue, 1 Apr 2014 01:04:35 +0000 (18:04 -0700)
committerSage Weil <sage@redhat.com>
Wed, 30 Jul 2014 04:28:52 +0000 (21:28 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/mon/MonitorDBStore.h

index fa11c21ad5a59ea371f6c96003bf74db3d262bb4..a203ab558de5b93f3cc364d8be115c11dd33f435 100644 (file)
@@ -214,6 +214,7 @@ OPTION(mon_debug_dump_location, OPT_STR, "/var/log/ceph/$cluster-$name.tdump")
 OPTION(mon_sync_provider_kill_at, OPT_INT, 0)  // kill the sync provider at a specific point in the work flow
 OPTION(mon_sync_requester_kill_at, OPT_INT, 0) // kill the sync requester at a specific point in the work flow
 OPTION(mon_force_quorum_join, OPT_BOOL, false) // force monitor to join quorum even if it has been previously removed from the map
+OPTION(mon_keyvaluedb, OPT_STR, "leveldb")   // type of keyvaluedb backend
 OPTION(paxos_stash_full_interval, OPT_INT, 25)   // how often (in commits) to stash a full copy of the PaxosService state
 OPTION(paxos_max_join_drift, OPT_INT, 10) // max paxos iterations before we must first sync the monitor stores
 OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0)  // gather updates for this long before proposing a map update
index 43ee7fad9cb508cb00719787d4adc2f7f977d09d..6b51f4b077f3b3c1368c9370eaf85c8ca908eb21 100644 (file)
@@ -21,7 +21,6 @@
 #include <boost/scoped_ptr.hpp>
 #include <sstream>
 #include "os/KeyValueDB.h"
-#include "os/LevelDBStore.h"
 
 #include "include/assert.h"
 #include "common/Formatter.h"
@@ -29,7 +28,7 @@
 
 class MonitorDBStore
 {
-  boost::scoped_ptr<LevelDBStore> db;
+  boost::scoped_ptr<KeyValueDB> db;
   bool do_dump;
   int dump_fd;
 
@@ -520,11 +519,14 @@ class MonitorDBStore
     os << path.substr(0, path.size() - pos) << "/store.db";
     string full_path = os.str();
 
-    LevelDBStore *db_ptr = new LevelDBStore(g_ceph_context, full_path);
+    KeyValueDB *db_ptr = KeyValueDB::create(g_ceph_context,
+                                           g_conf->mon_keyvaluedb,
+                                           full_path);
     if (!db_ptr) {
-      derr << __func__ << " error initializing level db back storage in "
-               << full_path << dendl;
-      assert(0 != "MonitorDBStore: error initializing level db back storage");
+      derr << __func__ << " error initializing "
+          << g_conf->mon_keyvaluedb << " db back storage in "
+          << full_path << dendl;
+      assert(0 != "MonitorDBStore: error initializing keyvaluedb back storage");
     }
     db.reset(db_ptr);
 
@@ -540,7 +542,7 @@ class MonitorDBStore
       }
     }
   }
-  MonitorDBStore(LevelDBStore *db_ptr) :
+  MonitorDBStore(KeyValueDB *db_ptr) :
     db(0), do_dump(false), dump_fd(-1) {
     db.reset(db_ptr);
   }