]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson, os: put AlienStore::omap_get_values() on top of OS::omap_iterate()
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 5 Nov 2024 15:15:29 +0000 (15:15 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 17 Dec 2024 19:17:49 +0000 (19:17 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/os/alienstore/alien_store.cc
src/os/ObjectStore.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/memstore/MemStore.cc
src/os/memstore/MemStore.h

index 3fd2bb1fd1572675d0609eeb273f22f0e99e3e51..e3b840f7f2c9d65ee9ee86ec265f7a69d8c84e04 100644 (file)
@@ -429,8 +429,21 @@ auto AlienStore::omap_get_values(CollectionRef ch,
   return do_with_op_gate(omap_values_t{}, [=, this] (auto &values) {
     return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, this, &values] {
       auto c = static_cast<AlienCollection*>(ch.get());
-      return store->omap_get_values(c->collection, oid, start,
-                                   reinterpret_cast<map<string, bufferlist>*>(&values));
+      return store->omap_iterate(
+        c->collection, oid,
+        ObjectStore::omap_iter_seek_t{
+          .seek_position = start.value_or(std::string{}),
+          // FIXME: classical OSDs begins iteration from LOWER_BOUND
+          // (or UPPER_BOUND if filter_prefix > start). However, these
+          // bits are not implemented yet
+          .seek_type = ObjectStore::omap_iter_seek_t::UPPER_BOUND
+        },
+        [&values]
+        (std::string_view key, std::string_view value) mutable {
+          values[std::string{key}].append(value);
+          // FIXME: there is limit on number of entries yet
+          return ObjectStore::omap_iter_ret_t::NEXT;
+        });
     }).then([&values] (int r)
       -> read_errorator::future<std::tuple<bool, omap_values_t>> {
       if (r == -ENOENT) {
index 282781855eff23f3b0ea45a7816e830479a58112..2b6ede94cd368044127f05979de11be28c6d487b 100644 (file)
@@ -736,15 +736,6 @@ public:
     std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
     ) = 0;
 
-#ifdef WITH_SEASTAR
-  virtual int omap_get_values(
-    CollectionHandle &c,         ///< [in] Collection containing oid
-    const ghobject_t &oid,       ///< [in] Object containing omap
-    const std::optional<std::string> &start_after,     ///< [in] Keys to get
-    std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
-    ) = 0;
-#endif
-
   /// Filters keys into out which are defined on oid
   virtual int omap_check_keys(
     CollectionHandle &c,     ///< [in] Collection containing oid
index 9c1a44fd9a5799d85ea2b50424fc7cd455812fba..e869d74e59bdf8b8e5168b55abba86c6d65c477e 100644 (file)
@@ -13617,52 +13617,6 @@ int BlueStore::omap_get_values(
   return r;
 }
 
-#ifdef WITH_SEASTAR
-int BlueStore::omap_get_values(
-  CollectionHandle &c_,        ///< [in] Collection containing oid
-  const ghobject_t &oid,       ///< [in] Object containing omap
-  const std::optional<string> &start_after,     ///< [in] Keys to get
-  map<string, bufferlist> *output ///< [out] Returned keys and values
-  )
-{
-  Collection *c = static_cast<Collection *>(c_.get());
-  dout(15) << __func__ << " " << c->get_cid() << " oid " << oid << dendl;
-  if (!c->exists)
-    return -ENOENT;
-  std::shared_lock l(c->lock);
-  int r = 0;
-  OnodeRef o = c->get_onode(oid, false);
-  if (!o || !o->exists) {
-    r = -ENOENT;
-    goto out;
-  }
-  if (!o->onode.has_omap()) {
-    goto out;
-  }
-  o->flush();
-  {
-    ObjectMap::ObjectMapIterator iter = get_omap_iterator(c_, oid);
-    if (!iter) {
-      r = -ENOENT;
-      goto out;
-    }
-    if (start_after) {
-      iter->upper_bound(*start_after);
-    } else {
-      iter->seek_to_first();
-    }
-    for (; iter->valid(); iter->next()) {
-      output->insert(make_pair(iter->key(), iter->value()));
-    }
-  }
-
-out:
-  dout(10) << __func__ << " " << c->get_cid() << " oid " << oid << " = " << r
-          << dendl;
-  return r;
-}
-#endif
-
 int BlueStore::omap_check_keys(
   CollectionHandle &c_,    ///< [in] Collection containing oid
   const ghobject_t &oid,   ///< [in] Object containing omap
index 67f52cf35cacff297cb43bdbcd06a8994c8c592d..ffcfc54b20d77682375841294a1243bec542f072 100644 (file)
@@ -3402,15 +3402,6 @@ public:
     std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
     ) override;
 
-#ifdef WITH_SEASTAR
-  int omap_get_values(
-    CollectionHandle &c,         ///< [in] Collection containing oid
-    const ghobject_t &oid,       ///< [in] Object containing omap
-    const std::optional<std::string> &start_after,     ///< [in] Keys to get
-    std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
-    ) override;
-#endif
-
   /// Filters keys into out which are defined on oid
   int omap_check_keys(
     CollectionHandle &c,                ///< [in] Collection containing oid
index db8969b82c781e8d198dced273815a3379cf8cef..a06b2f2d5894b4f3f54270f902c7960661b9b6b2 100644 (file)
@@ -537,30 +537,6 @@ int MemStore::omap_get_values(
   return 0;
 }
 
-#ifdef WITH_SEASTAR
-int MemStore::omap_get_values(
-  CollectionHandle& ch,                    ///< [in] Collection containing oid
-  const ghobject_t &oid,       ///< [in] Object containing omap
-  const std::optional<std::string> &start_after,     ///< [in] Keys to get
-  std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
-  )
-{
-  dout(10) << __func__ << " " << ch->cid << " " << oid << dendl;
-  Collection *c = static_cast<Collection*>(ch.get());
-  ObjectRef o = c->get_object(oid);
-  if (!o)
-    return -ENOENT;
-  assert(start_after);
-  std::lock_guard lock{o->omap_mutex};
-  for (auto it = o->omap.upper_bound(*start_after);
-       it != std::end(o->omap);
-       ++it) {
-    out->insert(*it);
-  }
-  return 0;
-}
-#endif
-
 int MemStore::omap_check_keys(
   CollectionHandle& ch,                ///< [in] Collection containing oid
   const ghobject_t &oid,   ///< [in] Object containing omap
index 2abe552891fd1f803d80036f6fd29151912354cc..61668ff17b1ff56ad9fa566ac9cb6902ee834ed0 100644 (file)
@@ -363,14 +363,6 @@ public:
     const std::set<std::string> &keys,     ///< [in] Keys to get
     std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
     ) override;
-#ifdef WITH_SEASTAR
-  int omap_get_values(
-    CollectionHandle &c,         ///< [in] Collection containing oid
-    const ghobject_t &oid,       ///< [in] Object containing omap
-    const std::optional<std::string> &start_after,     ///< [in] Keys to get
-    std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
-    ) override;
-#endif
 
   using ObjectStore::omap_check_keys;
   /// Filters keys into out which are defined on oid