]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: allow transition from Clean -> WaitLocalRecoveryReserved for repair
authorSage Weil <sage@inktank.com>
Fri, 21 Dec 2012 19:37:48 +0000 (11:37 -0800)
committerSage Weil <sage@inktank.com>
Fri, 21 Dec 2012 19:37:48 +0000 (11:37 -0800)
If we do a scrub repair, we need to go from clean to recovery again to
copy objects around.

This fixes a simple repair of a missing object, either on the primary or
replica.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/PG.cc
src/osd/PG.h

index a88887fbcdbdb6c686c42ca4920a237748c2a40f..54a75be5e6ae5a8f9b585b6cb6aa7fb4173f3713 100644 (file)
@@ -3406,6 +3406,7 @@ void PG::build_inc_scrub_map(ScrubMap &map, eversion_t v)
 
 void PG::repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer, int ok_peer)
 {
+  dout(10) << "repair_object " << soid << " bad_peer osd." << bad_peer << " ok_peer osd." << ok_peer << dendl;
   eversion_t v;
   bufferlist bv;
   bv.push_back(po->attrs[OI_ATTR]);
@@ -3422,7 +3423,12 @@ void PG::repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer
 
     log.last_requested = 0;
   }
-  osd->queue_for_recovery(this);
+  queue_peering_event(
+    CephPeeringEvtRef(
+      new CephPeeringEvt(
+        get_osdmap()->get_epoch(),
+       get_osdmap()->get_epoch(),
+       DoRecovery())));
 }
 
 /* replica_scrub
index acaa89708d643830c8833116f6c313a5cca0a806..e66b45b2f769015f362907d68db31987c6186a7e 100644 (file)
@@ -1348,6 +1348,7 @@ public:
       boost::statechart::result react(const AdvMap &advmap);
     };
 
+    struct WaitLocalRecoveryReserved;
     struct Activating;
     struct Active : boost::statechart::state< Active, Primary, Activating >, NamedState {
       Active(my_context ctx);
@@ -1380,6 +1381,9 @@ public:
     };
 
     struct Clean : boost::statechart::state< Clean, Active >, NamedState {
+      typedef boost::mpl::list<
+       boost::statechart::transition< DoRecovery, WaitLocalRecoveryReserved >
+      > reactions;
       Clean(my_context ctx);
       void exit();
     };