]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: migrate PeeringEvent to new tracking infra.
authorRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 14 Apr 2022 11:23:12 +0000 (13:23 +0200)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 5 May 2022 02:06:31 +0000 (04:06 +0200)
Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/crimson/osd/osd_operations/peering_event.cc
src/crimson/osd/osd_operations/peering_event.h

index a43fb8d2c3ed5550fd440c66d85af6f3dabf51e2..a5893f262f2f13a5874543367123a601e629d217 100644 (file)
@@ -9,6 +9,7 @@
 #include "common/Formatter.h"
 #include "crimson/osd/pg.h"
 #include "crimson/osd/osd.h"
+#include "crimson/osd/osd_operation_external_tracking.h"
 #include "crimson/osd/osd_operations/peering_event.h"
 #include "crimson/osd/osd_connection_priv.h"
 
@@ -70,19 +71,20 @@ seastar::future<> PeeringEvent::start()
     }
     return interruptor::with_interruption([this, pg] {
       logger().debug("{}: pg present", *this);
-      return with_blocking_future_interruptible<interruptor::condition>(
-        handle.enter(pp(*pg).await_map)
+      return enter_stage<interruptor>(
+        pp(*pg).await_map
       ).then_interruptible([this, pg] {
-        return with_blocking_future_interruptible<interruptor::condition>(
-          pg->osdmap_gate.wait_for_map(evt.get_epoch_sent()));
+        return with_blocking_event<PG_OSDMapGate::OSDMapBlocker::BlockingEvent>(
+        [this, pg] (auto&& trigger) {
+          return pg->osdmap_gate.wait_for_map(std::move(trigger),
+                                              evt.get_epoch_sent());
+       });
       }).then_interruptible([this, pg](auto) {
-        return with_blocking_future_interruptible<interruptor::condition>(
-          handle.enter(pp(*pg).process));
+        return enter_stage<interruptor>(pp(*pg).process);
       }).then_interruptible([this, pg] {
         // TODO: likely we should synchronize also with the pg log-based
         // recovery.
-        return with_blocking_future_interruptible<interruptor::condition>(
-          handle.enter(BackfillRecovery::bp(*pg).process));
+        return enter_stage<interruptor>(BackfillRecovery::bp(*pg).process);
       }).then_interruptible([this, pg] {
         pg->do_peering_event(evt, ctx);
         handle.exit();
@@ -176,12 +178,11 @@ seastar::future<> RemotePeeringEvent::complete_rctx_no_pg()
 
 seastar::future<Ref<PG>> RemotePeeringEvent::get_pg()
 {
-  return with_blocking_future(
-    handle.enter(op().await_active)
-  ).then([this] {
+#if 0
+  return enter_stage<>(op().await_active).then([this] {
     return osd.state.when_active();
   }).then([this] {
-    return with_blocking_future(handle.enter(cp().await_map));
+    return enter_stage<>(cp().await_map);
   }).then([this] {
     return with_blocking_future(
       osd.osdmap_gate.wait_for_map(evt.get_epoch_sent()));
@@ -193,6 +194,9 @@ seastar::future<Ref<PG>> RemotePeeringEvent::get_pg()
       osd.get_or_create_pg(
        pgid, evt.get_epoch_sent(), std::move(evt.create_info)));
   });
+#else
+  return seastar::make_ready_future<Ref<PG>>(nullptr);
+#endif
 }
 
 seastar::future<Ref<PG>> LocalPeeringEvent::get_pg() {
index fd8d2d751b04ad9c39b5bd93cca3de46782c4da1..9e44dfc3a94c1c558ee9c8d4edd04da83beaf2c1 100644 (file)
@@ -6,7 +6,9 @@
 #include <iostream>
 #include <seastar/core/future.hh>
 
+#include "crimson/osd/osdmap_gate.h"
 #include "crimson/osd/osd_operation.h"
+#include "crimson/osd/osd_operations/background_recovery.h"
 #include "osd/osd_types.h"
 #include "osd/PGPeeringEvent.h"
 #include "osd/PeeringState.h"
@@ -21,17 +23,17 @@ class OSD;
 class ShardServices;
 class PG;
 
-class PeeringEvent : public TrackableOperationT<PeeringEvent> {
+class PeeringEvent : public PhasedOperationT<PeeringEvent> {
 public:
   static constexpr OperationTypeCode type = OperationTypeCode::peering_event;
 
   class PGPipeline {
-    OrderedExclusivePhase await_map = {
-      "PeeringEvent::PGPipeline::await_map"
-    };
-    OrderedExclusivePhase process = {
-      "PeeringEvent::PGPipeline::process"
-    };
+    struct AwaitMap : OrderedExclusivePhaseT<AwaitMap> {
+      static constexpr auto type_name = "PeeringEvent::PGPipeline::await_map";
+    } await_map;
+    struct Process : OrderedExclusivePhaseT<Process> {
+      static constexpr auto type_name = "PeeringEvent::PGPipeline::process";
+    } process;
     friend class PeeringEvent;
     friend class PGAdvanceMap;
   };
@@ -88,6 +90,23 @@ public:
   void print(std::ostream &) const final;
   void dump_detail(ceph::Formatter* f) const final;
   seastar::future<> start();
+
+  std::tuple<
+    StartEvent,
+    PGPipeline::AwaitMap::BlockingEvent,
+    PG_OSDMapGate::OSDMapBlocker::BlockingEvent,
+    PGPipeline::Process::BlockingEvent,
+    BackfillRecovery::BackfillRecoveryPipeline::Process::BlockingEvent,
+#if 0
+    PGPipeline::WaitForActive::BlockingEvent,
+    PGActivationBlocker::BlockingEvent,
+    PGPipeline::RecoverMissing::BlockingEvent,
+    PGPipeline::GetOBC::BlockingEvent,
+    PGPipeline::WaitRepop::BlockingEvent,
+    PGPipeline::SendReply::BlockingEvent,
+#endif
+    CompletionEvent
+  > tracking_events;
 };
 
 class RemotePeeringEvent : public PeeringEvent {
@@ -102,18 +121,21 @@ protected:
 
 public:
   class OSDPipeline {
-    OrderedExclusivePhase await_active = {
-      "PeeringRequest::OSDPipeline::await_active"
-    };
+    struct AwaitActive : OrderedExclusivePhaseT<AwaitActive> {
+      static constexpr auto type_name =
+       "PeeringRequest::OSDPipeline::await_active";
+    } await_active;
     friend class RemotePeeringEvent;
   };
   class ConnectionPipeline {
-    OrderedExclusivePhase await_map = {
-      "PeeringRequest::ConnectionPipeline::await_map"
-    };
-    OrderedExclusivePhase get_pg = {
-      "PeeringRequest::ConnectionPipeline::get_pg"
-    };
+    struct AwaitMap : OrderedExclusivePhaseT<AwaitMap> {
+      static constexpr auto type_name =
+       "PeeringRequest::ConnectionPipeline::await_map";
+    } await_map;
+    struct GetPG : OrderedExclusivePhaseT<GetPG> {
+      static constexpr auto type_name =
+       "PeeringRequest::ConnectionPipeline::get_pg";
+    } get_pg;
     friend class RemotePeeringEvent;
   };
 
@@ -124,6 +146,11 @@ public:
     conn(conn)
   {}
 
+  std::tuple<
+    OSDPipeline::AwaitActive::BlockingEvent,
+    ConnectionPipeline::AwaitMap::BlockingEvent,
+    ConnectionPipeline::GetPG::BlockingEvent
+  > tracking_events;
 private:
   ConnectionPipeline &cp();
   OSDPipeline &op();