Skip to content

Commit 3c2b4bb

Browse files
committed
crimson, os: put AlienStore::omap_get_values() on top of OS::omap_iterate()
Signed-off-by: Radoslaw Zarzynski <[email protected]>
1 parent 0850828 commit 3c2b4bb

File tree

6 files changed

+15
-98
lines changed

6 files changed

+15
-98
lines changed

src/crimson/os/alienstore/alien_store.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,21 @@ auto AlienStore::omap_get_values(CollectionRef ch,
429429
return do_with_op_gate(omap_values_t{}, [=, this] (auto &values) {
430430
return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, this, &values] {
431431
auto c = static_cast<AlienCollection*>(ch.get());
432-
return store->omap_get_values(c->collection, oid, start,
433-
reinterpret_cast<map<string, bufferlist>*>(&values));
432+
return store->omap_iterate(
433+
c->collection, oid,
434+
ObjectStore::omap_iter_seek_t{
435+
.seek_position = start.value_or(std::string{}),
436+
// FIXME: classical OSDs begins iteration from LOWER_BOUND
437+
// (or UPPER_BOUND if filter_prefix > start). However, these
438+
// bits are not implemented yet
439+
.seek_type = ObjectStore::omap_iter_seek_t::UPPER_BOUND
440+
},
441+
[&values]
442+
(std::string_view key, std::string_view value) mutable {
443+
values[std::string{key}].append(value);
444+
// FIXME: there is limit on number of entries yet
445+
return ObjectStore::omap_iter_ret_t::NEXT;
446+
});
434447
}).then([&values] (int r)
435448
-> read_errorator::future<std::tuple<bool, omap_values_t>> {
436449
if (r == -ENOENT) {

src/os/ObjectStore.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -736,15 +736,6 @@ class ObjectStore {
736736
std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
737737
) = 0;
738738

739-
#ifdef WITH_SEASTAR
740-
virtual int omap_get_values(
741-
CollectionHandle &c, ///< [in] Collection containing oid
742-
const ghobject_t &oid, ///< [in] Object containing omap
743-
const std::optional<std::string> &start_after, ///< [in] Keys to get
744-
std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
745-
) = 0;
746-
#endif
747-
748739
/// Filters keys into out which are defined on oid
749740
virtual int omap_check_keys(
750741
CollectionHandle &c, ///< [in] Collection containing oid

src/os/bluestore/BlueStore.cc

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13617,52 +13617,6 @@ int BlueStore::omap_get_values(
1361713617
return r;
1361813618
}
1361913619

13620-
#ifdef WITH_SEASTAR
13621-
int BlueStore::omap_get_values(
13622-
CollectionHandle &c_, ///< [in] Collection containing oid
13623-
const ghobject_t &oid, ///< [in] Object containing omap
13624-
const std::optional<string> &start_after, ///< [in] Keys to get
13625-
map<string, bufferlist> *output ///< [out] Returned keys and values
13626-
)
13627-
{
13628-
Collection *c = static_cast<Collection *>(c_.get());
13629-
dout(15) << __func__ << " " << c->get_cid() << " oid " << oid << dendl;
13630-
if (!c->exists)
13631-
return -ENOENT;
13632-
std::shared_lock l(c->lock);
13633-
int r = 0;
13634-
OnodeRef o = c->get_onode(oid, false);
13635-
if (!o || !o->exists) {
13636-
r = -ENOENT;
13637-
goto out;
13638-
}
13639-
if (!o->onode.has_omap()) {
13640-
goto out;
13641-
}
13642-
o->flush();
13643-
{
13644-
ObjectMap::ObjectMapIterator iter = get_omap_iterator(c_, oid);
13645-
if (!iter) {
13646-
r = -ENOENT;
13647-
goto out;
13648-
}
13649-
if (start_after) {
13650-
iter->upper_bound(*start_after);
13651-
} else {
13652-
iter->seek_to_first();
13653-
}
13654-
for (; iter->valid(); iter->next()) {
13655-
output->insert(make_pair(iter->key(), iter->value()));
13656-
}
13657-
}
13658-
13659-
out:
13660-
dout(10) << __func__ << " " << c->get_cid() << " oid " << oid << " = " << r
13661-
<< dendl;
13662-
return r;
13663-
}
13664-
#endif
13665-
1366613620
int BlueStore::omap_check_keys(
1366713621
CollectionHandle &c_, ///< [in] Collection containing oid
1366813622
const ghobject_t &oid, ///< [in] Object containing omap

src/os/bluestore/BlueStore.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,15 +3402,6 @@ class BlueStore : public ObjectStore,
34023402
std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
34033403
) override;
34043404

3405-
#ifdef WITH_SEASTAR
3406-
int omap_get_values(
3407-
CollectionHandle &c, ///< [in] Collection containing oid
3408-
const ghobject_t &oid, ///< [in] Object containing omap
3409-
const std::optional<std::string> &start_after, ///< [in] Keys to get
3410-
std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
3411-
) override;
3412-
#endif
3413-
34143405
/// Filters keys into out which are defined on oid
34153406
int omap_check_keys(
34163407
CollectionHandle &c, ///< [in] Collection containing oid

src/os/memstore/MemStore.cc

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -537,30 +537,6 @@ int MemStore::omap_get_values(
537537
return 0;
538538
}
539539

540-
#ifdef WITH_SEASTAR
541-
int MemStore::omap_get_values(
542-
CollectionHandle& ch, ///< [in] Collection containing oid
543-
const ghobject_t &oid, ///< [in] Object containing omap
544-
const std::optional<std::string> &start_after, ///< [in] Keys to get
545-
std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
546-
)
547-
{
548-
dout(10) << __func__ << " " << ch->cid << " " << oid << dendl;
549-
Collection *c = static_cast<Collection*>(ch.get());
550-
ObjectRef o = c->get_object(oid);
551-
if (!o)
552-
return -ENOENT;
553-
assert(start_after);
554-
std::lock_guard lock{o->omap_mutex};
555-
for (auto it = o->omap.upper_bound(*start_after);
556-
it != std::end(o->omap);
557-
++it) {
558-
out->insert(*it);
559-
}
560-
return 0;
561-
}
562-
#endif
563-
564540
int MemStore::omap_check_keys(
565541
CollectionHandle& ch, ///< [in] Collection containing oid
566542
const ghobject_t &oid, ///< [in] Object containing omap

src/os/memstore/MemStore.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,6 @@ class MemStore : public ObjectStore {
363363
const std::set<std::string> &keys, ///< [in] Keys to get
364364
std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
365365
) override;
366-
#ifdef WITH_SEASTAR
367-
int omap_get_values(
368-
CollectionHandle &c, ///< [in] Collection containing oid
369-
const ghobject_t &oid, ///< [in] Object containing omap
370-
const std::optional<std::string> &start_after, ///< [in] Keys to get
371-
std::map<std::string, ceph::buffer::list> *out ///< [out] Returned keys and values
372-
) override;
373-
#endif
374366

375367
using ObjectStore::omap_check_keys;
376368
/// Filters keys into out which are defined on oid

0 commit comments

Comments
 (0)