From 4bd466d6ed49c7192df4a5bf0d63bda5d7d7dd9a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 31 Jul 2012 14:01:57 -0700 Subject: [PATCH] osd: peering: detect when log source osd goes down The Peering state has a generic check based on the prior set osds that will restart peering if one of them goes down (or one of the interesting down ones comes up). The GetLog state, however, can pull the log from a peer that is not in the prior set if it got a notify from them (e.g., an osd in an old interval that was down when the prior set was calculated). If that osd goes down, we don't detect it and will block forward. Fix by adding a simple check in GetLog for the newest_update_osd going down. (BTW GetMissing does not suffer from this problem because peer_missing_requested is a subset of the prior set, so the Peering check is sufficient.) Signed-off-by: Sage Weil Reviewed-by: Samuel Just --- src/osd/PG.cc | 15 +++++++++++++++ src/osd/PG.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c68e49c8c9c59..a80d95dcbaea0 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4758,6 +4758,21 @@ PG::RecoveryState::GetLog::GetLog(my_context ctx) : pg_query_t(pg_query_t::LOG, request_log_from, pg->info.history)); } +boost::statechart::result PG::RecoveryState::GetLog::react(const AdvMap& advmap) +{ + // make sure our log source didn't go down. we need to check + // explicitly because it may not be part of the prior set, which + // means the Peering state check won't catch it going down. + if (!advmap.osdmap->is_up(newest_update_osd)) { + dout(10) << "GetLog: newest_update_osd osd." << newest_update_osd << " went down" << dendl; + post_event(advmap); + return transit< Reset >(); + } + + // let the Peering state do its checks. + return forward_event(); +} + boost::statechart::result PG::RecoveryState::GetLog::react(const MLogRec& logevt) { assert(!msg); diff --git a/src/osd/PG.h b/src/osd/PG.h index 4b843aa14bd3b..4a292f6b3d09c 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1154,8 +1154,10 @@ public: boost::statechart::custom_reaction< QueryState >, boost::statechart::custom_reaction< MLogRec >, boost::statechart::custom_reaction< GotLog >, + boost::statechart::custom_reaction< AdvMap >, boost::statechart::transition< IsIncomplete, Incomplete > > reactions; + boost::statechart::result react(const AdvMap&); boost::statechart::result react(const QueryState& q); boost::statechart::result react(const MLogRec& logevt); boost::statechart::result react(const GotLog&); -- 2.39.5