]> git.apps.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)
committerSamuel Just <sam.just@inktank.com>
Wed, 27 Nov 2013 23:17:33 +0000 (15:17 -0800)
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>
src/osd/PG.cc
src/osd/PG.h

index 72c9dfa49322c9d41d442fe5029114a91bb3a69a..672b38730d97d9883575a06e001ef537872a1e44 100644 (file)
@@ -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);
index 8106ea073b7b3934eb4c4895e20fe3fd21ee5bab..083286675dd493a6d912a9f761bcde43d0019678 100644 (file)
@@ -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();
     };