virtual store_statfs_t stat() const = 0;
using CollectionRef = boost::intrusive_ptr<FuturizedCollection>;
-
- // TODO: using read_errorator = ceph::errorator<...>
- struct read_errorator : crimson::errorator<crimson::ct_error::enoent> {
- // just for the makeshift period of switching to errorator
- struct throw_as_runtime_error : discard_all {
- auto operator()(const auto& e) {
- throw std::runtime_error("legacy throwing");
- return discard_all::operator()(e);
- }
- };
- };
+ using read_errorator = crimson::errorator<crimson::ct_error::enoent>;
virtual read_errorator::future<ceph::bufferlist> read(
CollectionRef c,
const ghobject_t& oid,
osd_op.rval = bl.length();
osd_op.outdata = std::move(bl);
return seastar::now();
- }, PGBackend::read_errorator::discard_all{});
+ },
+ // TODO: move this error handling do PG::do_osd_ops().
+ crimson::ct_error::input_output_error::handle([] {
+ throw ceph::osd::input_output_error{};
+ }),
+ crimson::ct_error::object_corrupted::handle([] {
+ throw ceph::osd::object_corrupted{};
+ }),
+ crimson::ct_error::enoent::handle([] {
+ throw ceph::osd::object_not_found{};
+ }),
+ crimson::ct_error::enodata::handle([] {
+ throw ceph::osd::no_message_available{};
+ }));
});
case CEPH_OSD_OP_GETXATTR:
return do_read_op([&osd_op] (auto& backend, const auto& os) {
#include "osd_meta.h"
#include <fmt/format.h>
+#include <fmt/ostream.h>
#include "crimson/os/futurized_collection.h"
#include "crimson/os/futurized_store.h"
return store->read(coll,
osdmap_oid(e), 0, 0,
CEPH_OSD_OP_FLAG_FADVISE_WILLNEED).safe_then(
- [] (auto&& bl) { return bl; },
- read_errorator::throw_as_runtime_error{});
+ [] (auto&& bl) {
+ // TODO: introduce `::handle_error()` to errorated futures
+ // to avoid lambas like this one.
+ return bl;
+ }, crimson::ct_error::enoent::handle([e] {
+ throw std::runtime_error(fmt::format("read gave enoent on {}",
+ osdmap_oid(e)));
+ }));
}
void OSDMeta::store_superblock(ceph::os::Transaction& t,
seastar::future<OSDSuperblock> OSDMeta::load_superblock()
{
- return store->read(coll, superblock_oid(), 0, 0)
- .safe_then([this] (bufferlist&& bl) {
+ return store->read(coll, superblock_oid(), 0, 0).safe_then(
+ [this] (bufferlist&& bl) {
auto p = bl.cbegin();
OSDSuperblock superblock;
decode(superblock, p);
return seastar::make_ready_future<OSDSuperblock>(std::move(superblock));
- }, read_errorator::throw_as_runtime_error{});
+ }, crimson::ct_error::enoent::handle([] {
+ throw std::runtime_error(fmt::format("read gave enoent on {}",
+ superblock_oid()));
+ }));
}
seastar::future<pg_pool_t,
ec_profile_t>(std::move(pi),
std::move(name),
std::move(ec_profile));
- }, read_errorator::throw_as_runtime_error{});
+ }, crimson::ct_error::enoent::handle([pool] {
+ throw std::runtime_error(fmt::format("read gave enoent on {}",
+ final_pool_info_oid(pool)));
+ }));
}
ghobject_t OSDMeta::osdmap_oid(epoch_t epoch)