From: Samuel Just Date: Tue, 26 Nov 2013 21:20:21 +0000 (-0800) Subject: PG: retry GetLog() each time we get a notify in Incomplete X-Git-Tag: v0.74~56 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=964c8e978f86713e37a13b4884a6c0b9b41b5bae;p=ceph.git PG: retry GetLog() each time we get a notify in Incomplete If for some reason there are no up OSDs in the history which happen to have usable copies of the pg, it's possible that there is a usable copy elsewhere on the cluster which will become known to the primary if it waits. Fixes: #6909 Signed-off-by: Samuel Just Reviewed-by: Greg Farnum Reviewed-by: Sage Weil --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 72c9dfa4932..672b38730d9 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6706,6 +6706,21 @@ boost::statechart::result PG::RecoveryState::Incomplete::react(const AdvMap &adv return forward_event(); } +boost::statechart::result PG::RecoveryState::Incomplete::react(const MNotifyRec& notevt) { + dout(7) << "handle_pg_notify from osd." << notevt.from << dendl; + PG *pg = context< RecoveryMachine >().pg; + if (pg->peer_info.count(notevt.from) && + pg->peer_info[notevt.from].last_update == notevt.notify.info.last_update) { + dout(10) << *pg << " got dup osd." << notevt.from << " info " << notevt.notify.info + << ", identical to ours" << dendl; + return discard_event(); + } else { + pg->proc_replica_info(notevt.from, notevt.notify.info); + // try again! + return transit< GetLog >(); + } +} + void PG::RecoveryState::Incomplete::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); diff --git a/src/osd/PG.h b/src/osd/PG.h index 8106ea073b7..083286675dd 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1607,10 +1607,12 @@ public: struct Incomplete : boost::statechart::state< Incomplete, Peering>, NamedState { typedef boost::mpl::list < - boost::statechart::custom_reaction< AdvMap > + boost::statechart::custom_reaction< AdvMap >, + boost::statechart::custom_reaction< MNotifyRec > > reactions; Incomplete(my_context ctx); boost::statechart::result react(const AdvMap &advmap); + boost::statechart::result react(const MNotifyRec& infoevt); void exit(); };