Blame SOURCES/0008-mon-MonitorDBStore-use-generic-KeyValueDB-create.patch

4b13ad
From 239e095275500e82cfe143db83f79a9b84c2014a Mon Sep 17 00:00:00 2001
4b13ad
From: Sage Weil <sage@inktank.com>
4b13ad
Date: Mon, 31 Mar 2014 18:04:35 -0700
4b13ad
Subject: [PATCH] mon/MonitorDBStore: use generic KeyValueDB::create()
4b13ad
4b13ad
Signed-off-by: Sage Weil <sage@inktank.com>
4b13ad
(cherry picked from commit a2a36192c28e4961b92c576172185a915daef366)
4b13ad
---
4b13ad
 src/common/config_opts.h |  1 +
4b13ad
 src/mon/MonitorDBStore.h | 16 +++++++++-------
4b13ad
 2 files changed, 10 insertions(+), 7 deletions(-)
4b13ad
4b13ad
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
4b13ad
index f8dd5f0..bb6e1f3 100644
4b13ad
--- a/src/common/config_opts.h
4b13ad
+++ b/src/common/config_opts.h
4b13ad
@@ -221,6 +221,7 @@ OPTION(mon_leveldb_paranoid, OPT_BOOL, false)   // monitor's leveldb paranoid fl
4b13ad
 OPTION(mon_leveldb_log, OPT_STR, "")
4b13ad
 OPTION(mon_leveldb_size_warn, OPT_U64, 40*1024*1024*1024) // issue a warning when the monitor's leveldb goes over 40GB (in bytes)
4b13ad
 OPTION(mon_force_quorum_join, OPT_BOOL, false) // force monitor to join quorum even if it has been previously removed from the map
4b13ad
+OPTION(mon_keyvaluedb, OPT_STR, "leveldb")   // type of keyvaluedb backend
4b13ad
 OPTION(paxos_stash_full_interval, OPT_INT, 25)   // how often (in commits) to stash a full copy of the PaxosService state
4b13ad
 OPTION(paxos_max_join_drift, OPT_INT, 10) // max paxos iterations before we must first sync the monitor stores
4b13ad
 OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0)  // gather updates for this long before proposing a map update
4b13ad
diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h
4b13ad
index 741d6ec..1ee3070 100644
4b13ad
--- a/src/mon/MonitorDBStore.h
4b13ad
+++ b/src/mon/MonitorDBStore.h
4b13ad
@@ -21,7 +21,6 @@
4b13ad
 #include <boost/scoped_ptr.hpp>
4b13ad
 #include <sstream>
4b13ad
 #include "os/KeyValueDB.h"
4b13ad
-#include "os/LevelDBStore.h"
4b13ad
 
4b13ad
 #include "include/assert.h"
4b13ad
 #include "common/Formatter.h"
4b13ad
@@ -29,7 +28,7 @@
4b13ad
 
4b13ad
 class MonitorDBStore
4b13ad
 {
4b13ad
-  boost::scoped_ptr<LevelDBStore> db;
4b13ad
+  boost::scoped_ptr<KeyValueDB> db;
4b13ad
   bool do_dump;
4b13ad
   int dump_fd;
4b13ad
 
4b13ad
@@ -522,11 +521,14 @@ class MonitorDBStore
4b13ad
     os << path.substr(0, path.size() - pos) << "/store.db";
4b13ad
     string full_path = os.str();
4b13ad
 
4b13ad
-    LevelDBStore *db_ptr = new LevelDBStore(g_ceph_context, full_path);
4b13ad
+    KeyValueDB *db_ptr = KeyValueDB::create(g_ceph_context,
4b13ad
+					    g_conf->mon_keyvaluedb,
4b13ad
+					    full_path);
4b13ad
     if (!db_ptr) {
4b13ad
-      derr << __func__ << " error initializing level db back storage in "
4b13ad
-		<< full_path << dendl;
4b13ad
-      assert(0 != "MonitorDBStore: error initializing level db back storage");
4b13ad
+      derr << __func__ << " error initializing "
4b13ad
+	   << g_conf->mon_keyvaluedb << " db back storage in "
4b13ad
+	   << full_path << dendl;
4b13ad
+      assert(0 != "MonitorDBStore: error initializing keyvaluedb back storage");
4b13ad
     }
4b13ad
     db.reset(db_ptr);
4b13ad
 
4b13ad
@@ -542,7 +544,7 @@ class MonitorDBStore
4b13ad
       }
4b13ad
     }
4b13ad
   }
4b13ad
-  MonitorDBStore(LevelDBStore *db_ptr) :
4b13ad
+  MonitorDBStore(KeyValueDB *db_ptr) :
4b13ad
     db(0), do_dump(false), dump_fd(-1) {
4b13ad
     db.reset(db_ptr);
4b13ad
   }
4b13ad
-- 
4b13ad
1.9.3
4b13ad