]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use separate CF for omap and deferred
authorSage Weil <sage@redhat.com>
Mon, 2 Oct 2017 20:50:23 +0000 (15:50 -0500)
committerSage Weil <sage@redhat.com>
Thu, 5 Oct 2017 03:01:02 +0000 (22:01 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/options.cc
src/os/bluestore/BlueStore.cc

index 4a5aca9538f27dadb5688220ce4dc2c7b8bad5f4..f9c09a62ae00676d51ff4ec132b54dee04071c80 100644 (file)
@@ -3447,6 +3447,10 @@ std::vector<Option> get_global_options() {
     .set_default("compression=kNoCompression,max_write_buffer_number=4,min_write_buffer_number_to_merge=1,recycle_log_file_num=4,write_buffer_size=268435456,writable_file_max_buffer_size=0,compaction_readahead_size=2097152")
     .set_description("Rocksdb options"),
 
+    Option("bluestore_rocksdb_cf", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("Enable use of rocksdb column families for bluestore metadata"),
+
     Option("bluestore_fsck_on_mount", Option::TYPE_BOOL, Option::LEVEL_DEV)
     .set_default(false)
     .set_description("Run fsck at mount"),
index a2da49751b456d8796e7827d1cd053e5a2d5b092..26afef866ce6d3e5a14c3033e239f7aa61087bdf 100644 (file)
@@ -68,6 +68,11 @@ 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_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).
@@ -4735,10 +4740,17 @@ int BlueStore::_open_db(bool create)
   if (kv_backend == "rocksdb")
     options = cct->_conf->bluestore_rocksdb_options;
   db->init(options);
-  if (create)
-    r = db->create_and_open(err);
-  else
-    r = db->open(err);
+  if (create) {
+    if (cct->_conf->get_val<bool>("bluestore_rocksdb_cf")) {
+      r = db->create_and_open(err, cfs);
+    } else {
+      r = db->create_and_open(err);
+    }
+  } else {
+    // we pass in cf list here, but it is only used if the db already has
+    // column families created.
+    r = db->open(err, cfs);
+  }
   if (r) {
     derr << __func__ << " erroring opening db: " << err.str() << dendl;
     if (bluefs) {