diff options
author | Kefu Chai <kchai@redhat.com> | 2021-06-06 03:45:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-06 03:45:16 +0200 |
commit | 76d882bd6dc255cde9c124bcae8016c4da514d05 (patch) | |
tree | c70184186dcb0df33ed5c3ee44805f2e164c510c /src | |
parent | Merge PR #41665 into master (diff) | |
parent | crimson/os/seastore: open_collection() returns nullptr if DNE (diff) | |
download | ceph-76d882bd6dc255cde9c124bcae8016c4da514d05.tar.xz ceph-76d882bd6dc255cde9c124bcae8016c4da514d05.zip |
Merge pull request #41708 from tchaikov/wip-seastore-open-coll
crimson/os/seastore: open_collection() returns nullptr if DNE
Reviewed-by: Samuel Just <sjust@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/crimson/os/seastore/collection_manager/collection_flat_node.cc | 10 | ||||
-rw-r--r-- | src/crimson/os/seastore/seastore.cc | 9 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/crimson/os/seastore/collection_manager/collection_flat_node.cc b/src/crimson/os/seastore/collection_manager/collection_flat_node.cc index 1cd440d2b6b..bb8754e58eb 100644 --- a/src/crimson/os/seastore/collection_manager/collection_flat_node.cc +++ b/src/crimson/os/seastore/collection_manager/collection_flat_node.cc @@ -48,13 +48,9 @@ CollectionNode::list() { read_to_local(); logger().debug("CollectionNode:{}, {}", __func__, *this); - std::vector<std::pair<coll_t, coll_info_t>> list_result; - for (auto &&it : decoded) { - list_result.emplace_back( - std::make_pair( - static_cast<coll_t>(it.first), - coll_info_t{ it.second } - )); + CollectionManager::list_ret_bare list_result; + for (auto &[coll, bits] : decoded) { + list_result.emplace_back(coll, bits); } return list_ret( list_ertr::ready_future_marker{}, diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc index 91cf5fdc9c1..901e20128f5 100644 --- a/src/crimson/os/seastore/seastore.cc +++ b/src/crimson/os/seastore/seastore.cc @@ -155,7 +155,14 @@ seastar::future<CollectionRef> SeaStore::open_collection(const coll_t& cid) { LOG_PREFIX(SeaStore::open_collection); DEBUG("{}", cid); - return seastar::make_ready_future<CollectionRef>(_get_collection(cid)); + return list_collections().then([cid, this] (auto colls) { + if (auto found = std::find(colls.begin(), colls.end(), cid); + found != colls.end()) { + return seastar::make_ready_future<CollectionRef>(_get_collection(cid)); + } else { + return seastar::make_ready_future<CollectionRef>(); + } + }); } seastar::future<std::vector<coll_t>> SeaStore::list_collections() |