]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: dynamically configure CFs and options via bluestore_rocksdb_cfs 18224/head
authorSage Weil <sage@redhat.com>
Tue, 10 Oct 2017 20:05:39 +0000 (15:05 -0500)
committerSage Weil <sage@redhat.com>
Fri, 13 Oct 2017 02:39:47 +0000 (21:39 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/options.cc
src/os/bluestore/BlueStore.cc

index 5b8a4da681725adf4d85f72113921e2a5b80ff84..5188c55a35b8db26c7ffebb2bacbf069e18bdd8c 100644 (file)
@@ -3474,6 +3474,10 @@ std::vector<Option> get_global_options() {
     .set_default(false)
     .set_description("Enable use of rocksdb column families for bluestore metadata"),
 
+    Option("bluestore_rocksdb_cfs", Option::TYPE_STR, Option::LEVEL_DEV)
+    .set_default("M= P= L=")
+    .set_description("List of whitespace-separate key/value pairs where key is CF name and value is CF options"),
+
     Option("bluestore_fsck_on_mount", Option::TYPE_BOOL, Option::LEVEL_DEV)
     .set_default(false)
     .set_description("Run fsck at mount"),
index d5df329a97a6e3cb8c30086e96cd1be9b8b00b07..04d3e0af533aa0c087e621ae85dbfe542fac0f52 100644 (file)
@@ -24,6 +24,7 @@
 #include "include/compat.h"
 #include "include/intarith.h"
 #include "include/stringify.h"
+#include "include/str_map.h"
 #include "common/errno.h"
 #include "common/safe_io.h"
 #include "Allocator.h"
@@ -69,12 +70,6 @@ const string PREFIX_ALLOC = "B";   // u64 offset -> u64 length (freelist)
 const string PREFIX_ALLOC_BITMAP = "b"; // (see BitmapFreelistManager)
 const string PREFIX_SHARED_BLOB = "X"; // u64 offset -> shared_blob_t
 
-const std::vector<KeyValueDB::ColumnFamily> cfs = {
-  KeyValueDB::ColumnFamily(PREFIX_OMAP, ""),
-  KeyValueDB::ColumnFamily(PREFIX_PGMETA_OMAP, ""),
-  KeyValueDB::ColumnFamily(PREFIX_DEFERRED, ""),
-};
-
 // write a label in the first block.  always use this size.  note that
 // bluefs makes a matching assumption about the location of its
 // superblock (always the second block of the device).
@@ -4492,6 +4487,8 @@ int BlueStore::_open_db(bool create)
   ceph::shared_ptr<Int64ArrayMergeOperator> merge_op(new Int64ArrayMergeOperator);
 
   string kv_backend;
+  std::vector<KeyValueDB::ColumnFamily> cfs;
+
   if (create) {
     kv_backend = cct->_conf->bluestore_kvbackend;
   } else {
@@ -4739,8 +4736,18 @@ int BlueStore::_open_db(bool create)
 
   db->set_cache_size(cache_size * cache_kv_ratio);
 
-  if (kv_backend == "rocksdb")
+  if (kv_backend == "rocksdb") {
     options = cct->_conf->bluestore_rocksdb_options;
+
+    map<string,string> cf_map;
+    get_str_map(cct->_conf->get_val<string>("bluestore_rocksdb_cfs"), &cf_map,
+               " \t");
+    for (auto& i : cf_map) {
+      dout(10) << "column family " << i.first << ": " << i.second << dendl;
+      cfs.push_back(KeyValueDB::ColumnFamily(i.first, i.second));
+    }
+  }
+
   db->init(options);
   if (create) {
     if (cct->_conf->get_val<bool>("bluestore_rocksdb_cf")) {