]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RocksDBStore: use Get for multiget
authorHaomai Wang <haomai@xsky.com>
Thu, 2 Jun 2016 15:01:01 +0000 (23:01 +0800)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 4 Apr 2018 14:12:43 +0000 (10:12 -0400)
Signed-off-by: Haomai Wang <haomai@xsky.com>
(cherry picked from commit a44f4f7238585996f83f7e35e01587671fe675d4)

src/kv/RocksDBStore.cc

index 2e5be4b1e0d3847c123dfcce44c8fb0e73b5daec..8192edd4b31e365e0b2304051be8652e7e777f7f 100644 (file)
@@ -412,15 +412,13 @@ int RocksDBStore::get(
     std::map<string, bufferlist> *out)
 {
   utime_t start = ceph_clock_now(g_ceph_context);
-  KeyValueDB::Iterator it = get_iterator(prefix);
   for (std::set<string>::const_iterator i = keys.begin();
-       i != keys.end();
-       ++i) {
-    it->lower_bound(*i);
-    if (it->valid() && it->key() == *i) {
-      out->insert(make_pair(*i, it->value()));
-    } else if (!it->valid())
-      break;
+       i != keys.end(); ++i) {
+    std::string value;
+    std::string bound = combine_strings(prefix, *i);
+    auto status = db->Get(rocksdb::ReadOptions(), rocksdb::Slice(bound), &value);
+    if (status.ok())
+      (*out)[*i].append(value);
   }
   utime_t lat = ceph_clock_now(g_ceph_context) - start;
   logger->inc(l_rocksdb_gets);