From: David Zafman Date: Wed, 12 Aug 2020 21:32:32 +0000 (-0700) Subject: osd: Feature to add might_have_unfound info to list_unfound requests X-Git-Tag: v17.0.0~1099^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a787148ed20273b396f4a0e47bf64bd8ebf01765;p=ceph.git osd: Feature to add might_have_unfound info to list_unfound requests fixes: https://tracker.ceph.com/issues/39012 Signed-off-by: David Zafman --- diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 891405e1c63f9..af51893e41614 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -318,6 +318,36 @@ void PeeringState::purge_strays() peer_missing_requested.clear(); } +void PeeringState::query_unfound(Formatter *f, string state) +{ + psdout(20) << "Enter PeeringState common QueryUnfound" << dendl; + { + f->dump_string("state", state); + f->dump_bool("available_might_have_unfound", true); + f->open_array_section("might_have_unfound"); + for (auto p = might_have_unfound.begin(); + p != might_have_unfound.end(); + ++p) { + if (peer_missing.count(*p)) { + ; // Ignore already probed OSDs + } else { + f->open_object_section("osd"); + f->dump_stream("osd") << *p; + if (peer_missing_requested.count(*p)) { + f->dump_string("status", "querying"); + } else if (!get_osdmap()->is_up(p->osd)) { + f->dump_string("status", "osd is down"); + } else { + f->dump_string("status", "not queried"); + } + f->close_section(); + } + } + f->close_section(); + } + psdout(20) << "Exit PeeringState common QueryUnfound" << dendl; + return; +} bool PeeringState::proc_replica_info( pg_shard_t from, const pg_info_t &oinfo, epoch_t send_epoch) @@ -4324,6 +4354,13 @@ boost::statechart::result PeeringState::Started::react(const QueryState& q) return discard_event(); } +boost::statechart::result PeeringState::Started::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "Started"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::Started::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -4412,6 +4449,13 @@ boost::statechart::result PeeringState::Reset::react(const QueryState& q) return discard_event(); } +boost::statechart::result PeeringState::Reset::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "Reset"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::Reset::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -4625,6 +4669,13 @@ boost::statechart::result PeeringState::Peering::react(const QueryState& q) return forward_event(); } +boost::statechart::result PeeringState::Peering::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "Peering"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::Peering::exit() { @@ -4905,6 +4956,14 @@ PeeringState::NotBackfilling::NotBackfilling(my_context ctx) pl->publish_stats_to_osd(); } +boost::statechart::result PeeringState::NotBackfilling::react(const QueryUnfound& q) +{ + DECLARE_LOCALS; + + ps->query_unfound(q.f, "NotBackfilling"); + return discard_event(); +} + boost::statechart::result PeeringState::NotBackfilling::react(const RemoteBackfillReserved &evt) { @@ -4938,6 +4997,14 @@ PeeringState::NotRecovering::NotRecovering(my_context ctx) pl->publish_stats_to_osd(); } +boost::statechart::result PeeringState::NotRecovering::react(const QueryUnfound& q) +{ + DECLARE_LOCALS; + + ps->query_unfound(q.f, "NotRecovering"); + return discard_event(); +} + void PeeringState::NotRecovering::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -5802,6 +5869,14 @@ boost::statechart::result PeeringState::Active::react(const QueryState& q) return forward_event(); } +boost::statechart::result PeeringState::Active::react(const QueryUnfound& q) +{ + DECLARE_LOCALS; + + ps->query_unfound(q.f, "Active"); + return discard_event(); +} + boost::statechart::result PeeringState::Active::react( const ActivateCommitted &evt) { @@ -6101,6 +6176,13 @@ boost::statechart::result PeeringState::ReplicaActive::react(const QueryState& q return forward_event(); } +boost::statechart::result PeeringState::ReplicaActive::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "ReplicaActive"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::ReplicaActive::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -6469,6 +6551,13 @@ boost::statechart::result PeeringState::GetInfo::react(const QueryState& q) return forward_event(); } +boost::statechart::result PeeringState::GetInfo::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "GetInfo"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::GetInfo::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -6603,6 +6692,13 @@ boost::statechart::result PeeringState::GetLog::react(const QueryState& q) return forward_event(); } +boost::statechart::result PeeringState::GetLog::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "GetLog"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::GetLog::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -6665,6 +6761,13 @@ boost::statechart::result PeeringState::WaitActingChange::react(const QueryState return forward_event(); } +boost::statechart::result PeeringState::WaitActingChange::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "WaitActingChange"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::WaitActingChange::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -6714,6 +6817,13 @@ boost::statechart::result PeeringState::Down::react(const QueryState& q) return forward_event(); } +boost::statechart::result PeeringState::Down::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "Down"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + boost::statechart::result PeeringState::Down::react(const MNotifyRec& infoevt) { DECLARE_LOCALS; @@ -6791,6 +6901,13 @@ boost::statechart::result PeeringState::Incomplete::react( return forward_event(); } +boost::statechart::result PeeringState::Incomplete::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "Incomplete"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::Incomplete::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -6943,6 +7060,13 @@ boost::statechart::result PeeringState::GetMissing::react(const QueryState& q) return forward_event(); } +boost::statechart::result PeeringState::GetMissing::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "GetMising"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::GetMissing::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); @@ -6989,6 +7113,13 @@ boost::statechart::result PeeringState::WaitUpThru::react(const QueryState& q) return forward_event(); } +boost::statechart::result PeeringState::WaitUpThru::react(const QueryUnfound& q) +{ + q.f->dump_string("state", "WaitUpThru"); + q.f->dump_bool("available_might_have_unfound", false); + return discard_event(); +} + void PeeringState::WaitUpThru::exit() { context< PeeringMachine >().log_exit(state_name, enter_time); diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 7583a583b5fe1..e0fe398833660 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -438,6 +438,14 @@ public: } }; + struct QueryUnfound : boost::statechart::event< QueryUnfound > { + ceph::Formatter *f; + explicit QueryUnfound(ceph::Formatter *f) : f(f) {} + void print(std::ostream *out) const { + *out << "QueryUnfound"; + } + }; + struct AdvMap : boost::statechart::event< AdvMap > { OSDMapRef osdmap; OSDMapRef lastmap; @@ -680,6 +688,7 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< AdvMap >, boost::statechart::custom_reaction< ActMap >, boost::statechart::custom_reaction< NullEvt >, @@ -687,6 +696,7 @@ public: boost::statechart::transition< boost::statechart::event_base, Crashed > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const AdvMap&); boost::statechart::result react(const ActMap&); boost::statechart::result react(const IntervalFlush&); @@ -703,6 +713,7 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< AdvMap >, boost::statechart::custom_reaction< IntervalFlush >, // ignored @@ -717,6 +728,7 @@ public: boost::statechart::transition< boost::statechart::event_base, Crashed > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const AdvMap&); boost::statechart::result react(const IntervalFlush&); boost::statechart::result react(const boost::statechart::event_base&) { @@ -768,6 +780,7 @@ public: NamedState { typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< AdvMap >, boost::statechart::custom_reaction< MLogRec >, boost::statechart::custom_reaction< MInfoRec >, @@ -775,6 +788,7 @@ public: > reactions; explicit WaitActingChange(my_context ctx); boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const AdvMap&); boost::statechart::result react(const MLogRec&); boost::statechart::result react(const MInfoRec&); @@ -794,10 +808,12 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::transition< Activate, Active >, boost::statechart::custom_reaction< AdvMap > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const AdvMap &advmap); }; @@ -813,6 +829,7 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< ActMap >, boost::statechart::custom_reaction< AdvMap >, boost::statechart::custom_reaction< MInfoRec >, @@ -834,6 +851,7 @@ public: boost::statechart::custom_reaction< CheckReadable> > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const ActMap&); boost::statechart::result react(const AdvMap&); boost::statechart::result react(const MInfoRec& infoevt); @@ -955,23 +973,27 @@ public: struct NotBackfilling : boost::statechart::state< NotBackfilling, Active>, NamedState { typedef boost::mpl::list< + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::transition< RequestBackfill, WaitLocalBackfillReserved>, boost::statechart::custom_reaction< RemoteBackfillReserved >, boost::statechart::custom_reaction< RemoteReservationRejectedTooFull > > reactions; explicit NotBackfilling(my_context ctx); void exit(); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const RemoteBackfillReserved& evt); boost::statechart::result react(const RemoteReservationRejectedTooFull& evt); }; struct NotRecovering : boost::statechart::state< NotRecovering, Active>, NamedState { typedef boost::mpl::list< + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::transition< DoRecovery, WaitLocalRecoveryReserved >, boost::statechart::custom_reaction< DeferRecovery >, boost::statechart::custom_reaction< UnfoundRecovery > > reactions; explicit NotRecovering(my_context ctx); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const DeferRecovery& evt) { /* no-op */ return discard_event(); @@ -991,6 +1013,7 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< ActMap >, boost::statechart::custom_reaction< MQuery >, boost::statechart::custom_reaction< MInfoRec >, @@ -1009,6 +1032,7 @@ public: boost::statechart::custom_reaction< MLease > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const MInfoRec& infoevt); boost::statechart::result react(const MLogRec& logevt); boost::statechart::result react(const MTrim& trimevt); @@ -1239,11 +1263,13 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::transition< GotInfo, GetLog >, boost::statechart::custom_reaction< MNotifyRec >, boost::statechart::transition< IsDown, Down > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const MNotifyRec& infoevt); }; @@ -1260,6 +1286,7 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< MLogRec >, boost::statechart::custom_reaction< GotLog >, boost::statechart::custom_reaction< AdvMap >, @@ -1268,6 +1295,7 @@ public: > reactions; boost::statechart::result react(const AdvMap&); boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const MLogRec& logevt); boost::statechart::result react(const GotLog&); }; @@ -1282,10 +1310,12 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< MLogRec >, boost::statechart::transition< NeedUpThru, WaitUpThru > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const MLogRec& logevt); }; @@ -1295,10 +1325,12 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< ActMap >, boost::statechart::custom_reaction< MLogRec > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const ActMap& am); boost::statechart::result react(const MLogRec& logrec); }; @@ -1307,9 +1339,11 @@ public: explicit Down(my_context ctx); typedef boost::mpl::list < boost::statechart::custom_reaction< QueryState >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< MNotifyRec > > reactions; boost::statechart::result react(const QueryState& q); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const MNotifyRec& infoevt); void exit(); }; @@ -1318,11 +1352,13 @@ public: typedef boost::mpl::list < boost::statechart::custom_reaction< AdvMap >, boost::statechart::custom_reaction< MNotifyRec >, + boost::statechart::custom_reaction< QueryUnfound >, boost::statechart::custom_reaction< QueryState > > reactions; explicit Incomplete(my_context ctx); boost::statechart::result react(const AdvMap &advmap); boost::statechart::result react(const MNotifyRec& infoevt); + boost::statechart::result react(const QueryUnfound& q); boost::statechart::result react(const QueryState& q); void exit(); }; @@ -1478,6 +1514,7 @@ public: } void update_heartbeat_peers(); + void query_unfound(Formatter *f, string state); bool proc_replica_info( pg_shard_t from, const pg_info_t &oinfo, epoch_t send_epoch); void remove_down_peer_info(const OSDMapRef &osdmap); diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index fbcb64c72e84f..3b7f6338e2edb 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -1119,6 +1119,9 @@ void PrimaryLogPG::do_command( } f->close_section(); } + // Get possible locations of missing objects from pg information + PeeringState::QueryUnfound q(f.get()); + recovery_state.handle_event(q, 0); f->dump_bool("more", p != needs_recovery_map.end()); f->close_section(); }