]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: retry GetLog() each time we get a notify in Incomplete
authorSamuel Just <sam.just@inktank.com>
Tue, 26 Nov 2013 21:20:21 +0000 (13:20 -0800)
committerSage Weil <sage@inktank.com>
Mon, 7 Apr 2014 15:41:41 +0000 (08:41 -0700)
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 <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 964c8e978f86713e37a13b4884a6c0b9b41b5bae)

src/osd/PG.cc
src/osd/PG.h

index c2c69ba8e991c14b8faa337fbedfd13092a79b74..973559e455c81ec34b2555d24be7edb15c8499c4 100644 (file)
@@ -6689,6 +6689,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);
index d4679ce4fd84f091b88e2bf4f143154fc0e70933..176802f6be55c65dca7e4d358506a9827e277903 100644 (file)
@@ -1600,10 +1600,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();
     };