From f091a70e3c6932d6056f7bdf8e31682263bd08f9 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 19 Dec 2022 21:44:12 +0000 Subject: [PATCH] crimson/osd: errorate SnapTrimEvent Signed-off-by: Radoslaw Zarzynski --- .../osd/osd_operations/snaptrim_event.cc | 22 ++++++++++--------- .../osd/osd_operations/snaptrim_event.h | 14 ++++++++---- src/crimson/osd/pg.cc | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/crimson/osd/osd_operations/snaptrim_event.cc b/src/crimson/osd/osd_operations/snaptrim_event.cc index 22154c304e9..09f7e1f6f58 100644 --- a/src/crimson/osd/osd_operations/snaptrim_event.cc +++ b/src/crimson/osd/osd_operations/snaptrim_event.cc @@ -46,7 +46,7 @@ void SnapTrimEvent::SubOpBlocker::emplace_back(Args&&... args) subops.emplace_back(std::forward(args)...); }; -SnapTrimEvent::interruptible_future<> +SnapTrimEvent::remove_or_update_iertr::future<> SnapTrimEvent::SubOpBlocker::wait_completion() { return interruptor::do_for_each(subops, [](auto&& kv) { @@ -70,7 +70,8 @@ void SnapTrimEvent::dump_detail(Formatter *f) const f->close_section(); } -seastar::future SnapTrimEvent::start() +SnapTrimEvent::remove_or_update_ertr::future +SnapTrimEvent::start() { logger().debug("{}: {}", *this, __func__); return with_pg( @@ -86,7 +87,8 @@ CommonPGPipeline& SnapTrimEvent::pp() return pg->request_pg_pipeline; } -seastar::future SnapTrimEvent::with_pg( +SnapTrimEvent::remove_or_update_ertr::future +SnapTrimEvent::with_pg( ShardServices &shard_services, Ref _pg) { return interruptor::with_interruption([&shard_services, this] { @@ -135,8 +137,8 @@ seastar::future SnapTrimEvent::with_pg( return to_trim; }).then_interruptible([&shard_services, this] (const auto& to_trim) { if (to_trim.empty()) { - // ENOENT - return interruptor::make_ready_future( + // the legit ENOENT -> done + return remove_or_update_iertr::make_ready_future( seastar::stop_iteration::yes); } for (const auto& object : to_trim) { @@ -147,7 +149,7 @@ seastar::future SnapTrimEvent::with_pg( snapid); subop_blocker.emplace_back( op->get_id(), - std::move(fut).handle_error_interruptible(crimson::ct_error::assert_all{}) + std::move(fut) ); } return enter_stage( @@ -155,7 +157,7 @@ seastar::future SnapTrimEvent::with_pg( ).then_interruptible([this] { logger().debug("{}: awaiting completion", *this); return subop_blocker.wait_completion(); - }).then_interruptible([this] { + }).safe_then_interruptible([this] { if (!needs_pause) { return interruptor::now(); } @@ -172,9 +174,9 @@ seastar::future SnapTrimEvent::with_pg( return seastar::sleep( std::chrono::milliseconds(std::lround(time_to_sleep * 1000))); }); - }).then_interruptible([this] { + }).safe_then_interruptible([this] { logger().debug("{}: all completed", *this); - return interruptor::make_ready_future( + return remove_or_update_iertr::make_ready_future( seastar::stop_iteration::no); }); }); @@ -182,7 +184,7 @@ seastar::future SnapTrimEvent::with_pg( }, [this](std::exception_ptr eptr) { // TODO: better debug output logger().debug("{}: interrupted {}", *this, eptr); - return seastar::make_ready_future( + return remove_or_update_ertr::make_ready_future( seastar::stop_iteration::no); }, pg); } diff --git a/src/crimson/osd/osd_operations/snaptrim_event.h b/src/crimson/osd/osd_operations/snaptrim_event.h index 13b42723ea2..714d2ff3af2 100644 --- a/src/crimson/osd/osd_operations/snaptrim_event.h +++ b/src/crimson/osd/osd_operations/snaptrim_event.h @@ -30,6 +30,12 @@ class PG; // trim up to `max` objects for snapshot `snapid class SnapTrimEvent final : public PhasedOperationT { public: + using remove_or_update_ertr = + crimson::errorator; + using remove_or_update_iertr = + crimson::interruptible::interruptible_errorator< + IOInterruptCondition, remove_or_update_ertr>; + static constexpr OperationTypeCode type = OperationTypeCode::snaptrim_event; SnapTrimEvent(Ref pg, @@ -43,8 +49,8 @@ public: void print(std::ostream &) const final; void dump_detail(ceph::Formatter* f) const final; - seastar::future start(); - seastar::future with_pg( + remove_or_update_ertr::future start(); + remove_or_update_ertr::future with_pg( ShardServices &shard_services, Ref pg); private: @@ -55,14 +61,14 @@ private: static constexpr const char* type_name = "CompoundOpBlocker"; using id_done_t = std::pair>; + remove_or_update_iertr::future<>>; void dump_detail(Formatter *f) const final; template void emplace_back(Args&&... args); - interruptible_future<> wait_completion(); + remove_or_update_iertr::future<> wait_completion(); private: std::vector subops; } subop_blocker; diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 98da7ff5dba..c95da5c4851 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -468,7 +468,7 @@ void PG::on_active_actmap() this, snap_mapper, to_trim, - needs_pause).second; + needs_pause).second.handle_error(crimson::ct_error::assert_all{}); }).then([this, trimmed=to_trim] { logger().debug("{}: trimmed snap={}", *this, trimmed); }); -- 2.39.5