From d65b89e83914fb321b4854e57430698a02ab19d8 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Mon, 20 Nov 2017 16:09:30 -0500 Subject: [PATCH] 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 --- src/kv/RocksDBStore.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 767b4720bb1..809564064f7 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"); -- 2.39.5