crimson/osd: handle attr retrieval errors with all_same_way().

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
Radoslaw Zarzynski 2019-09-15 17:18:33 +02:00
parent de325ade55
commit 1221b899b0
2 changed files with 17 additions and 15 deletions

View File

@ -175,13 +175,8 @@ static seastar::future<hobject_t> pgls_filter(
val.push_back(std::move(bp));
const bool filtered = filter.filter(sobj, val);
return seastar::make_ready_future<hobject_t>(filtered ? sobj : hobject_t{});
}, [&filter, sobj] (const auto& e) {
// TODO: sugar-coat error handling. Compile-time visitors require
// too much of fragile boilerplate.
using T = std::decay_t<decltype(e)>;
static_assert(std::is_same_v<T, crimson::ct_error::enoent> ||
std::is_same_v<T, crimson::ct_error::enodata>);
logger().debug("pgls_filter: got enoent for obj={}", sobj);
}, PGBackend::get_attr_errorator::all_same_way([&filter, sobj] {
logger().debug("pgls_filter: got error for obj={}", sobj);
if (filter.reject_empty_xattr()) {
return seastar::make_ready_future<hobject_t>(hobject_t{});
@ -189,7 +184,7 @@ static seastar::future<hobject_t> pgls_filter(
ceph::bufferlist val;
const bool filtered = filter.filter(sobj, val);
return seastar::make_ready_future<hobject_t>(filtered ? sobj : hobject_t{});
});
}));
} else {
ceph::bufferlist empty_lvalue_bl;
const bool filtered = filter.filter(sobj, empty_lvalue_bl);

View File

@ -125,13 +125,8 @@ PGBackend::_load_os(const hobject_t& oid)
return seastar::make_ready_future<cached_os_t>(
os_cache.insert(oid,
std::make_unique<ObjectState>(object_info_t{bl}, true /* exists */)));
},
crimson::ct_error::enoent::handle([oid, this] {
return seastar::make_ready_future<cached_os_t>(
os_cache.insert(oid,
std::make_unique<ObjectState>(object_info_t{oid}, false)));
}),
crimson::ct_error::enodata::handle([oid, this] {
}, crimson::errorator<crimson::ct_error::enoent,
crimson::ct_error::enodata>::all_same_way([oid, this] {
return seastar::make_ready_future<cached_os_t>(
os_cache.insert(oid,
std::make_unique<ObjectState>(object_info_t{oid}, false)));
@ -154,6 +149,7 @@ PGBackend::_load_ss(const hobject_t& oid)
bl.push_back(std::move(bp));
return seastar::make_ready_future<cached_ss_t>(
ss_cache.insert(oid, std::make_unique<SnapSet>(bl)));
<<<<<<< HEAD
},
[oid, this] (const auto& e) {
using T = std::decay_t<decltype(e)>;
@ -165,6 +161,17 @@ PGBackend::_load_ss(const hobject_t& oid)
static_assert(always_false<T>::value, "non-exhaustive visitor!");
}
});
=======
}, ceph::errorator<ceph::ct_error::enoent,
ceph::ct_error::enodata>::all_same_way([oid, this] {
// NOTE: the errors could have been handled by writing just:
// `get_attr_errorator::all_same_way(...)`.
// however, this way is more explicit and resilient to unexpected
// changes in the alias definition.
return seastar::make_ready_future<cached_ss_t>(
ss_cache.insert(oid, std::make_unique<SnapSet>()));
}));
>>>>>>> 72c0b99... crimson/osd: handle attr retrieval errors with all_same_way().
}
seastar::future<crimson::osd::acked_peers_t>