]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: introduce bluestore_rocksdb_options_annex config parameter. 38680/head
authorIgor Fedotov <ifedotov@suse.com>
Mon, 21 Dec 2020 21:01:52 +0000 (00:01 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 22 Dec 2020 17:03:14 +0000 (20:03 +0300)
This simplifies modifying a subset of rocksdb settings since it
eliminates the need to re-provide bluestore's rocksdb settings.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
PendingReleaseNotes
src/common/legacy_config_opts.h
src/common/options.cc
src/os/bluestore/BlueStore.cc

index af1c10f1843f3f5b3744b179749b6f7839b9fbfa..4d4513e99b383aa3c299ad14d417e9b5851e654e 100644 (file)
@@ -1,5 +1,8 @@
 >=16.0.0
 --------
+* New bluestore_rocksdb_options_annex config parameter. Complements
+  bluestore_rocksdb_options and allows setting rocksdb options without repeating
+  the existing defaults.
 * $pid expansion in config paths like `admin_socket` will now properly expand
   to the daemon pid for commands like `ceph-mds` or `ceph-osd`. Previously only
   `ceph-fuse`/`rbd-nbd` expanded `$pid` with the actual daemon pid.
index 162b324fdaa85c5d2541b3ec0050fa7994a9422f..08c26249f9accbddfa7280662717c22eb19adc20 100644 (file)
@@ -999,6 +999,7 @@ OPTION(bluestore_bitmapallocator_span_size, OPT_INT) // must be power of 2 align
 OPTION(bluestore_max_deferred_txc, OPT_U64)
 OPTION(bluestore_max_defer_interval, OPT_U64)
 OPTION(bluestore_rocksdb_options, OPT_STR)
+OPTION(bluestore_rocksdb_options_annex, OPT_STR)
 OPTION(bluestore_fsck_on_mount, OPT_BOOL)
 OPTION(bluestore_fsck_on_mount_deep, OPT_BOOL)
 OPTION(bluestore_fsck_quick_fix_on_mount, OPT_BOOL)
index 57901687e77f52cd3e2cf66a57fb7a2789cdc794..b268787ca4c22a5c6aa6c12d5caa81a24453233f 100644 (file)
@@ -4515,7 +4515,11 @@ std::vector<Option> get_global_options() {
 
     Option("bluestore_rocksdb_options", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .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,max_background_compactions=2,max_total_wal_size=1073741824")
-    .set_description("Rocksdb options"),
+    .set_description("Full set of rocksdb settings to override"),
+
+    Option("bluestore_rocksdb_options_annex", Option::TYPE_STR, Option::LEVEL_ADVANCED)
+    .set_default("")
+    .set_description("An addition to bluestore_rocksdb_options. Allows setting rocksdb options without repeating the existing defaults."),
 
     Option("bluestore_rocksdb_cf", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
     .set_default(true)
index e6535e2e8365fcf334697ae4bd14ee4bfcc5843a..5e0a77a9d4d4b8d5868329dcf5defb3b1a07939c 100644 (file)
@@ -5651,6 +5651,14 @@ int BlueStore::_open_bluefs(bool create, bool read_only)
   if (bluefs_layout.shared_bdev == BlueFS::BDEV_SLOW) {
 
     string options = cct->_conf->bluestore_rocksdb_options;
+    string options_annex = cct->_conf->bluestore_rocksdb_options_annex;
+    if (!options_annex.empty()) {
+      if (!options.empty() &&
+        *options.rbegin() != ',') {
+        options += ',';
+      }
+      options += options_annex;
+    }
 
     rocksdb::Options rocks_opts;
     r = RocksDBStore::ParseOptionsFromStringStatic(
@@ -6003,6 +6011,7 @@ int BlueStore::_open_db(bool create, bool to_repair_db, bool read_only)
   int r;
   ceph_assert(!(create && read_only));
   string options;
+  string options_annex;
   stringstream err;
   string kv_dir_fn;
   string kv_backend;
@@ -6014,6 +6023,15 @@ int BlueStore::_open_db(bool create, bool to_repair_db, bool read_only)
   }
   if (kv_backend == "rocksdb") {
     options = cct->_conf->bluestore_rocksdb_options;
+    options_annex = cct->_conf->bluestore_rocksdb_options_annex;
+    if (!options_annex.empty()) {
+      if (!options.empty() &&
+        *options.rbegin() != ',') {
+        options += ',';
+      }
+      options += options_annex;
+    }
+
     if (cct->_conf.get_val<bool>("bluestore_rocksdb_cf")) {
       sharding_def = cct->_conf.get_val<std::string>("bluestore_rocksdb_cfs");
     }