From e2fc6f9a93aa0cb0d7ff55e3dee7a9e928293bb7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Thu, 14 Apr 2022 13:23:12 +0200 Subject: [PATCH] crimson/osd: migrate PeeringEvent to new tracking infra. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Radosław Zarzyński --- .../osd/osd_operations/peering_event.cc | 28 +++++---- .../osd/osd_operations/peering_event.h | 59 ++++++++++++++----- 2 files changed, 59 insertions(+), 28 deletions(-) diff --git a/src/crimson/osd/osd_operations/peering_event.cc b/src/crimson/osd/osd_operations/peering_event.cc index a43fb8d2c3e..a5893f262f2 100644 --- a/src/crimson/osd/osd_operations/peering_event.cc +++ b/src/crimson/osd/osd_operations/peering_event.cc @@ -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( - handle.enter(pp(*pg).await_map) + return enter_stage( + pp(*pg).await_map ).then_interruptible([this, pg] { - return with_blocking_future_interruptible( - pg->osdmap_gate.wait_for_map(evt.get_epoch_sent())); + return with_blocking_event( + [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( - handle.enter(pp(*pg).process)); + return enter_stage(pp(*pg).process); }).then_interruptible([this, pg] { // TODO: likely we should synchronize also with the pg log-based // recovery. - return with_blocking_future_interruptible( - handle.enter(BackfillRecovery::bp(*pg).process)); + return enter_stage(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> 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> RemotePeeringEvent::get_pg() osd.get_or_create_pg( pgid, evt.get_epoch_sent(), std::move(evt.create_info))); }); +#else + return seastar::make_ready_future>(nullptr); +#endif } seastar::future> LocalPeeringEvent::get_pg() { diff --git a/src/crimson/osd/osd_operations/peering_event.h b/src/crimson/osd/osd_operations/peering_event.h index fd8d2d751b0..9e44dfc3a94 100644 --- a/src/crimson/osd/osd_operations/peering_event.h +++ b/src/crimson/osd/osd_operations/peering_event.h @@ -6,7 +6,9 @@ #include #include +#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 { +class PeeringEvent : public PhasedOperationT { 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 { + static constexpr auto type_name = "PeeringEvent::PGPipeline::await_map"; + } await_map; + struct Process : OrderedExclusivePhaseT { + 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 { + 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 { + static constexpr auto type_name = + "PeeringRequest::ConnectionPipeline::await_map"; + } await_map; + struct GetPG : OrderedExclusivePhaseT { + 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(); -- 2.39.5