]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kv/RocksDBStore: convert get() to use rocksdb Get() instead of iterator
authorJianjian Huo <jianjian.huo@ssi.samsung.com>
Wed, 25 May 2016 23:38:10 +0000 (16:38 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 4 Apr 2018 14:12:43 +0000 (10:12 -0400)
For RocksDB, iterator will bypass row cache.
We don't want this to happen for get(), after row cache is enabled.

Signed-off-by: Jianjian Huo <jianjian.huo@ssi.samsung.com>
(cherry picked from commit f6ac5579190549291f6385775070c305dc8fba8b)

Conflicts:
src/kv/RocksDBStore.cc (trivial)

src/kv/RocksDBStore.cc

index 11818e4c0911db9c04b4960efc528bbc5b2f9497..2e5be4b1e0d3847c123dfcce44c8fb0e73b5daec 100644 (file)
@@ -436,10 +436,12 @@ int RocksDBStore::get(
   assert(out && (out->length() == 0));
   utime_t start = ceph_clock_now(g_ceph_context);
   int r = 0;
-  KeyValueDB::Iterator it = get_iterator(prefix);
-  it->lower_bound(key);
-  if (it->valid() && it->key() == key) {
-    out->append(it->value_as_ptr());
+  string value, k;
+  rocksdb::Status s;
+  k = combine_strings(prefix, key);
+  s = db->Get(rocksdb::ReadOptions(), rocksdb::Slice(k), &value);
+  if (s.ok()) {
+    out->append(value);
   } else {
     r = -ENOENT;
   }