From: Adam C. Emerson Date: Mon, 20 Nov 2017 21:09:30 +0000 (-0500) Subject: kv/RocksDB: Do comparisons under with_val X-Git-Tag: v13.0.2~802^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d65b89e83914fb321b4854e57430698a02ab19d8;p=ceph.git kv/RocksDB: Do comparisons under with_val Rather than making a copy on the heap just to compare it. Signed-off-by: Adam C. Emerson --- diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 767b4720bb13..809564064f79 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -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("rocksdb_index_type") == "binary_search") + using std::placeholders::_1; + if (g_conf->with_val("rocksdb_index_type", + std::bind(std::equal_to(), _1, + "binary_search"))) bbt_opts.index_type = rocksdb::BlockBasedTableOptions::IndexType::kBinarySearch; - if (g_conf->get_val("rocksdb_index_type") == "hash_search") + if (g_conf->with_val("rocksdb_index_type", + std::bind(std::equal_to(), _1, + "hash_search"))) bbt_opts.index_type = rocksdb::BlockBasedTableOptions::IndexType::kHashSearch; - if (g_conf->get_val("rocksdb_index_type") == "two_level") + if (g_conf->with_val("rocksdb_index_type", + std::bind(std::equal_to(), _1, + "two_level"))) bbt_opts.index_type = rocksdb::BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch; bbt_opts.cache_index_and_filter_blocks = g_conf->get_val("rocksdb_cache_index_and_filter_blocks");