]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: errorate SnapTrimEvent
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 19 Dec 2022 21:44:12 +0000 (21:44 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 28 Feb 2023 16:22:05 +0000 (16:22 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/osd_operations/snaptrim_event.cc
src/crimson/osd/osd_operations/snaptrim_event.h
src/crimson/osd/pg.cc

index 22154c304e9a37e35523e43d000a1d5c63293c34..09f7e1f6f5828d2353bc83be03e00c3c52040b47 100644 (file)
@@ -46,7 +46,7 @@ void SnapTrimEvent::SubOpBlocker::emplace_back(Args&&... args)
   subops.emplace_back(std::forward<Args>(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<seastar::stop_iteration> SnapTrimEvent::start()
+SnapTrimEvent::remove_or_update_ertr::future<seastar::stop_iteration>
+SnapTrimEvent::start()
 {
   logger().debug("{}: {}", *this, __func__);
   return with_pg(
@@ -86,7 +87,8 @@ CommonPGPipeline& SnapTrimEvent::pp()
   return pg->request_pg_pipeline;
 }
 
-seastar::future<seastar::stop_iteration> SnapTrimEvent::with_pg(
+SnapTrimEvent::remove_or_update_ertr::future<seastar::stop_iteration>
+SnapTrimEvent::with_pg(
   ShardServices &shard_services, Ref<PG> _pg)
 {
   return interruptor::with_interruption([&shard_services, this] {
@@ -135,8 +137,8 @@ seastar::future<seastar::stop_iteration> 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<seastar::stop_iteration>(
+          // the legit ENOENT -> done
+          return remove_or_update_iertr::make_ready_future<seastar::stop_iteration>(
             seastar::stop_iteration::yes);
         }
         for (const auto& object : to_trim) {
@@ -147,7 +149,7 @@ seastar::future<seastar::stop_iteration> 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<interruptor>(
@@ -155,7 +157,7 @@ seastar::future<seastar::stop_iteration> 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<seastar::stop_iteration> 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<seastar::stop_iteration>(
+          return remove_or_update_iertr::make_ready_future<seastar::stop_iteration>(
             seastar::stop_iteration::no);
         });
       });
@@ -182,7 +184,7 @@ seastar::future<seastar::stop_iteration> SnapTrimEvent::with_pg(
   }, [this](std::exception_ptr eptr) {
     // TODO: better debug output
     logger().debug("{}: interrupted {}", *this, eptr);
-    return seastar::make_ready_future<seastar::stop_iteration>(
+    return remove_or_update_ertr::make_ready_future<seastar::stop_iteration>(
       seastar::stop_iteration::no);
   }, pg);
 }
index 13b42723ea281267325a49eac170fe63caf413d0..714d2ff3af21afdf7df943869a1080e9bdfaf441 100644 (file)
@@ -30,6 +30,12 @@ class PG;
 // trim up to `max` objects for snapshot `snapid
 class SnapTrimEvent final : public PhasedOperationT<SnapTrimEvent> {
 public:
+  using remove_or_update_ertr =
+    crimson::errorator<crimson::ct_error::enoent>;
+  using remove_or_update_iertr =
+    crimson::interruptible::interruptible_errorator<
+      IOInterruptCondition, remove_or_update_ertr>;
+
   static constexpr OperationTypeCode type = OperationTypeCode::snaptrim_event;
 
   SnapTrimEvent(Ref<PG> pg,
@@ -43,8 +49,8 @@ public:
 
   void print(std::ostream &) const final;
   void dump_detail(ceph::Formatter* f) const final;
-  seastar::future<seastar::stop_iteration> start();
-  seastar::future<seastar::stop_iteration> with_pg(
+  remove_or_update_ertr::future<seastar::stop_iteration> start();
+  remove_or_update_ertr::future<seastar::stop_iteration> with_pg(
     ShardServices &shard_services, Ref<PG> pg);
 
 private:
@@ -55,14 +61,14 @@ private:
     static constexpr const char* type_name = "CompoundOpBlocker";
 
     using id_done_t = std::pair<crimson::Operation::id_t,
-                                interruptible_future<>>;
+                                remove_or_update_iertr::future<>>;
 
     void dump_detail(Formatter *f) const final;
 
     template <class... Args>
     void emplace_back(Args&&... args);
 
-    interruptible_future<> wait_completion();
+    remove_or_update_iertr::future<> wait_completion();
   private:
     std::vector<id_done_t> subops;
   } subop_blocker;
index 98da7ff5dba65ea5747d1c0fa0a0ff7039b64b35..c95da5c4851e78e5b6a7d2304198025dcb0232ac 100644 (file)
@@ -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);
       });