]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kv/RocksDB: Do comparisons under with_val
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 20 Nov 2017 21:09:30 +0000 (16:09 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 7 Dec 2017 20:46:11 +0000 (15:46 -0500)
Rather than making a copy on the heap just to compare it.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/kv/RocksDBStore.cc

index 767b4720bb1335a98babbd9aeaceae7f2a060597..809564064f793a0d3ad05e1153fbc2c142a46bdf 100644 (file)
@@ -423,11 +423,18 @@ int RocksDBStore::load_rocksdb_options(bool create_if_missing, rocksdb::Options&
             << bloom_bits << dendl;
     bbt_opts.filter_policy.reset(rocksdb::NewBloomFilterPolicy(bloom_bits));
   }
-  if (g_conf->get_val<std::string>("rocksdb_index_type") == "binary_search")
+  using std::placeholders::_1;
+  if (g_conf->with_val<std::string>("rocksdb_index_type",
+                                   std::bind(std::equal_to<std::string>(), _1,
+                                             "binary_search")))
     bbt_opts.index_type = rocksdb::BlockBasedTableOptions::IndexType::kBinarySearch;
-  if (g_conf->get_val<std::string>("rocksdb_index_type") == "hash_search")
+  if (g_conf->with_val<std::string>("rocksdb_index_type",
+                                   std::bind(std::equal_to<std::string>(), _1,
+                                             "hash_search")))
     bbt_opts.index_type = rocksdb::BlockBasedTableOptions::IndexType::kHashSearch;
-  if (g_conf->get_val<std::string>("rocksdb_index_type") == "two_level")
+  if (g_conf->with_val<std::string>("rocksdb_index_type",
+                                   std::bind(std::equal_to<std::string>(), _1,
+                                             "two_level")))
     bbt_opts.index_type = rocksdb::BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch;
   bbt_opts.cache_index_and_filter_blocks = 
       g_conf->get_val<bool>("rocksdb_cache_index_and_filter_blocks");